[Kss-devel] Changing a form selection

Balazs Ree ree at ree.hu
Fri Mar 23 07:29:24 CET 2007


On Thu, 22 Mar 2007 11:49:29 -0700 Rob Campbell wrote:
 
> What is the best way to change the selected option in a form?  Here is
> an example of the form I am using.
> 
> <select name="licenseClass" id="licenseClass">
>   <option value="Technician">Technician</option> <option
>   value="General">General</option> <option
>   value="Advanced">Advanced</option> <option value="Amateur
>   Extra">Amateur Extra</option> <option value="Novice">Novice</option>
>   <option value="Technician Plus">Technician Plus</option> <option
>   value="None">None</option>
> </select>
> 
> The form is being generated by ReMember.  Is there a way to change the
> selection using the licenseClass id?  Thank you.

I don't understand how the changing of the id could do anything with the 
selection.

But answering to the question, no, I don't remember that we have tried 
this actually. (Maybe, Christian Klinger did something similar?) Now I 
just looked up the html specifications, and it says that the initial 
selection can be set by setting the "selected" attribute on the option 
tag (or tags) that are selected.

However, to see if that works if you change it on an already rendered 
page, you must try that, and what's more, you need to try it in all the 
different supported browsers. Because without that you may never know if 
it would actually work.

For example, in IE we run into the problem that if we replace or add one 
or more option tags (as in the second kss demo), they would not change in 
the page. So for example on IE the only way to change the options is to 
replace the entire select, including the select tag itself. It took a 
long time to figure out this.

I am not saying that changing just the selection would raise similar 
issues but testing this would be essential. Also once it works it would 
be worth to make a new demo page in the kss demo product, for being able 
to test this in the automated tests.

-- 
Balazs Ree



More information about the Kss-devel mailing list