[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Radio button postback not quite working ...

Posted on 2006-07-18
3
Medium Priority
?
1,101 Views
Last Modified: 2012-06-22
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
                        
0
Comment
Question by:msiedle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 26

Accepted Solution

by:
DireOrbAnt earned 2000 total points
ID: 17135717
Try onclick vs onfocus:                    
                    <input onclick="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 onclick="this.form.action='screen_3.php';this.form.submit()" type="radio" name="lbnw" id="lbnw_yes" value="yes" />
                    <label for="lbnw_yes">Yes</label>
0
 
LVL 2

Author Comment

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

M
0
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17135768
I see a lot of people doing onfocus, but that's too early in the event game :)
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question