Link to home
Start Free TrialLog in
Avatar of msiedle
msiedle

asked on

Radio button postback not quite working ...

Hi all

I have a radio button group that gives two options: yes and no, and I want to make my form postback when these are clicked ... (as I am using php to create dynamic forms based on user input)

I found out how (or so i thought) using this method:

                        <input onfocus="this.form.action='screen_3.php';this.form.submit()" type="radio" name="lbnw" id="lbnw_no" value="no" />
                        <label for="lbnw_no">No</label>      
                        <br />                        
                        <input onfocus="this.form.action='screen_3.php';this.form.submit()" type="radio" name="lbnw" id="lbnw_yes" value="yes" />
                        <label for="lbnw_yes">Yes</label>

But while that causes a postback just like a form submission should, in Forefix it doesn't seem to remember the value of the radiobutton I just selected to cause the postback.

Eg. say the radio button is set to 'no' by default ...then I click 'yes' which causes the form to submit ...the value that is posted on the form submission is still 'no' in Firefox (works in IE though).

Does anyone know a way around this BESIDES me posting every variable in the query string like this:

                        <input onfocus="location.href='screen_3.php?var1=blah&var2=blah';" type="radio" name="ccpi" id="ccpi_no" value="no" />
                        <label for="ccpi_no">No</label>      
                        <br />                        
                        <input onfocus="location.href='screen_3.php?var1=blah&var2=blah';" type="radio" name="ccpi" id="ccpi_yes" value="yes" />
                        <label for="ccpi_yes">Yes</label>

Cheers,
Mark
                        
ASKER CERTIFIED SOLUTION
Avatar of DireOrbAnt
DireOrbAnt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of msiedle
msiedle

ASKER

Ahhhh, I'd have never figured that out. Didn't think it made any difference. Thank you!

M
I see a lot of people doing onfocus, but that's too early in the event game :)