Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: OnChange event problem
01-15-2012, 04:34 PM #1
- Join Date
- Jan 2012
- Thanked 0 Times in 0 Posts
OnChange event problem
Need a bit of help here, need this SELECT to submit the page and end up at the below URL, correctly passing the GET values through the string.
<select name="dir-fact-misma" id="dir-fact-misma" class="text100" tabindex="" onChange="alta_nueva.action='alta.php?page=p2#alta'; return true;">
<option value="Si" <?php if(!isset($_POST['dir-fact-misma']) || $_POST['dir-fact-misma'] == 'Si') print "Selected='Selected '"; ?>>Si</option>
<option value="No" <?php if(isset($_POST['dir-fact-misma']) && $_POST['dir-fact-misma'] == 'No') print "Selected='Selected '"; ?>>No</option>
the form in which this SELECT is placed needs to be submitted so that other fields in the form are not lost, they are saved in Session Variables.
<input name="p1" type='submit' id="p1" onclick="alta_nueva.action='alta.php?page=p1#alta'; return true;" value='1' />
the page is programmed in PHP.
Any help is appreciated.
01-16-2012, 02:10 AM #2
What is alta_nueva??
If that is the name of the <form> then you would need to use document.alta_nueva
But also, if it is the <form> that encloses the given <select> or <input>, then you should be coding it as simply this.form.....
There's almost never a reason to give an id to <form> fields. The name is needed, else the field won't be seen by the PHP code. But the id adds nothing useful to the mix.Code:<select name="dir-fact-misma" class="text100" onchange="this.form.action='alta.php?page=p2#alta'; this.form.submit();">
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.