?
Solved

Radio button postback not quite working ...

Posted on 2006-07-18
3
Medium Priority
?
1,090 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

771 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