floppy
Posts: 3
|
Posted: 07/30/2004, 10:13 PM |
|
I build a form includes a listbox "country" on my page using CCS.
the listbox may contain:
"Canada"
"United States"
"China"
"Canada" is default selected.
The value of listbox will be stored into database when i submit the form. for example, i set the value to "China". To modify the form,i need to make sure that the "China" item is selected for listbox when the page loads again. but it still set the "Canada" as the selected item.
I think maybe add some codes into beforeShow event for the listbox,but i didn't konw what shall i do,can you help me?
thank you
floppy
|
|
|
floppy
Posts: 3
|
Posted: 07/31/2004, 12:25 AM |
|
Does anyone help me?
|
|
|
Walter Kempees
|
Posted: 07/31/2004, 3:30 AM |
|
floppy
(Is me dogs name too)
In your question you don't mention anything about the tools your doing this
on PhP MySQL.
Is your form on a database table, if so what field in the table do your
store the value for the listbox.
It is that field that would actualy be the control for the listbox.
Id, Value
0,
1, Canada
2, United States
3, China
Then when your form is used first time, (Insert) it would present the
listbox with the 0 or NULL value presenting Choose from List or Select a
value.
You would then choose for instance United......., the form is submitted and
'2' is being stored.
Next time you open the form édit mode'it will display United.... as the
value in the database is '2'.
IF THIS DOES NOT WORK:
You are doing something wrong.
It is either in the select of the list box, or in the value list of the list
box. (Note it should always be a paired list (id,value(s))
Or you have an error in the properties of the listbox.
Tell me more and maybeI can make you a harddrive.
My fast approach would be:
In the form delete the listbox, get the field from the table back in the
form.
Check if the value of that field when inserted/edited stores correctly.
If it does, in Design mode select the field right-click change to Listbox
Give the listbox it's Select statement, or a list of values, check the colum
settings and the type, generate and GO!
Walter
"floppy" <floppy@forum.codecharge> schreef in bericht
news:5410b2a859267b@news.codecharge.com...
> I build a form includes a listbox "country" on my page using CCS.
>
> the listbox may contain:
> "Canada"
> "United States"
> "China"
>
> "Canada" is default selected.
>
> The value of listbox will be stored into database when i submit the form.
for
> example, i set the value to "China". To modify the form,i need to make
sure
> that the "China" item is selected for listbox when the page loads again.
but it
> still set the "Canada" as the selected item.
>
> I think maybe add some codes into beforeShow event for the listbox,but i
didn't
> konw what shall i do,can you help me?
>
> thank you
>
> floppy
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
|