Hi Scott,

Thanks for the guidance. This will work perfectly.


Brian Humes
Director, Interactive
JohnsonRauhoff Communications Group
269.428.9257 (Direct)
269.428.3377 (Main)
269.428.3312 (Fax)
www.johnson-rauhoff.com
[EMAIL PROTECTED]

_____________________________


On Sep 25, 2007, at 9:26 AM, Scott Cadillac wrote:

Hi Brian,

When dynamically adding options for a select list, use the javascript Option() object, something like so:

 var v_option = new Option();
 v_option.value = myOptionValue;
 v_option.text = myOptionText

Then add the new object to the bottom of the list

 var v_list = document.getElementById('mySelectList');

 v_list.options[v_list.options.length] = v_option;

This way the select element itself doesn't change (and therefore the selected value should have no problems posting). It's only the available options that change.

Note, the above is cross-browser, MSIE, Firefox, Opera, Safair and Konqueror.

If you're building a new set of options every time, then remove the previous set of options using a routine like the following:

Of course the trick to removing options is to delete them from the bottom up.

 var v_list = document.getElementById('mySelectList');

 for(var j = v_list.options.length; j >= 1; j--){
   v_list.options[(j - 1)] = null;
 }

Hope that helps.

Scott,
______________________________________________________________________ __
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf


________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to