Hello all,
I hope I'm posting in the right forum.
Data is going from cgi to form...given a value for a drop down box choice, and given also that the drop down box values are dynamically generated. How can you preserve the value of a drop down box choice a user has chosen after it's been error-checked?
Hrmm. I know the value....I can pass the value to the form. I don't know how to tell the form to stop doing 'selected' choice on the drop down list.
Original code:
Active/Discontinued: <select name="activeType">
<option value = "All">All</option>
<option value = "1" selected>Active</option>
<option value = "2">Discontinued</option>
</select>
So, in the code above, Active is chosen by default on the HTML and the script understands that 1 is the internal value for it. The "selected" part of this segment is enforced everytime it is reloaded.
So as a solution I thought I'd define a TMPL_VAR variable, set that as my 'selected' like so:
Active/Discontinued: <select name="activeType">
<option value = "<TMPL_VAR NAME="activeType">"><TMPL_VAR NAME="activeType" selected></option>
<option value = "1" >Active</option>
<option value = "2">Discontinued</option>
<option value = "All">All</option>
</select>
I'd initially set the TMPL_VAR at initial start then set it again as I recall it and set it to the appropriate value. I'm pretty sure I can get this to work but it seems awfully awkward somehow.
Yeah, lol I'm thinking and typing the solutions that are coming to mind....I dont' know if this will work but if anyone knows a more eloquent solution, pls, I'm quite interested.
(FYI: sys admin will NOT allow javascript to run on this machine AND will NOT allow me to use the validate.pm for perl.)
I hope I'm posting in the right forum.
Data is going from cgi to form...given a value for a drop down box choice, and given also that the drop down box values are dynamically generated. How can you preserve the value of a drop down box choice a user has chosen after it's been error-checked?
Hrmm. I know the value....I can pass the value to the form. I don't know how to tell the form to stop doing 'selected' choice on the drop down list.
Original code:
Active/Discontinued: <select name="activeType">
<option value = "All">All</option>
<option value = "1" selected>Active</option>
<option value = "2">Discontinued</option>
</select>
So, in the code above, Active is chosen by default on the HTML and the script understands that 1 is the internal value for it. The "selected" part of this segment is enforced everytime it is reloaded.
So as a solution I thought I'd define a TMPL_VAR variable, set that as my 'selected' like so:
Active/Discontinued: <select name="activeType">
<option value = "<TMPL_VAR NAME="activeType">"><TMPL_VAR NAME="activeType" selected></option>
<option value = "1" >Active</option>
<option value = "2">Discontinued</option>
<option value = "All">All</option>
</select>
I'd initially set the TMPL_VAR at initial start then set it again as I recall it and set it to the appropriate value. I'm pretty sure I can get this to work but it seems awfully awkward somehow.
Yeah, lol I'm thinking and typing the solutions that are coming to mind....I dont' know if this will work but if anyone knows a more eloquent solution, pls, I'm quite interested.
(FYI: sys admin will NOT allow javascript to run on this machine AND will NOT allow me to use the validate.pm for perl.)