Welcome Guest, Not a member yet? Register   Sign In
Clearing a select box after form submit.
#3

(02-12-2015, 06:46 AM)BrandenM Wrote: when I try to clear the form, the repopulated option acts as the selectedIndex ( as it should ) and I can't reset the input to the top option.
I think I had a problem similar to that, and I solved it this way.
PHP Code:
   <select name="gift_list]">
 
     <option value="0" <?= set_select('gift_list''0'?>>Select...</option> 
Basically, I treated the top option as a valid selection with value zero. If the user doesn't make a different selection (one that has a non-zero value), I can catch that during validation.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply


Messages In This Thread
RE: Clearing a select box after form submit. - by RobertSF - 02-13-2015, 06:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB