473,390 Members | 1,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

How to submit a form on a radio click

HD
Hi.

I have an asp page with radio buttons and a combobox... when the user clicks
a radio button, I want the form to submit so I can execute the ASP code in
order to change the list shown in the combobox... I have 2 radiobuttons:

<input type="radio" name="terriprod" value="E">E
<input type="radio" name="terriprod" value="D">D

I have tried adding an OnClick event to each of the radio button...
<input type="radio" name="terriprod" value="D"
onclick="javascript:document.forms[0].submit();">D
but it does not work...

I have then tried to put each of the radio button into an anchor...
<a href="javascript:document.forms[0].submit();"><input type="radio"
name="terriprod" value="D"></a>D
but it does not work...

I have then tried to add to the onclick event a javascript function
<input type="radio" name="terriprod" value="D"
onclick="javascript:Verif(document.forms[0]);">D
and in the Verif function I try to submit the form but it does not work...

I have also tried:
I have then tried to add to the onclick event a javascript function
<input type="radio" name="terriprod" value="D" onclick="javascript:if
Verif(document.forms[0]) {document.forms[0].submit();};">D

But it does not work...

Can someone help me.

HDumas
Jul 23 '05 #1
6 18797
Hello

Try this: <input type="radio" name="terriprod" value="D"
onclick="this.form.submit();">D

Anyway, the onclick events you added should work as well...What browser
you're using?
Perhaps you have other script errors in your page...

--
Elias
"HD" <du**@hotmail.com> wrote in message
news:Dn*********************@news20.bellglobal.com ...
Hi.

I have an asp page with radio buttons and a combobox... when the user
clicks
a radio button, I want the form to submit so I can execute the ASP code in
order to change the list shown in the combobox... I have 2 radiobuttons:

<input type="radio" name="terriprod" value="E">E
<input type="radio" name="terriprod" value="D">D

I have tried adding an OnClick event to each of the radio button...
<input type="radio" name="terriprod" value="D"
onclick="javascript:document.forms[0].submit();">D
but it does not work...

I have then tried to put each of the radio button into an anchor...
<a href="javascript:document.forms[0].submit();"><input type="radio"
name="terriprod" value="D"></a>D
but it does not work...

I have then tried to add to the onclick event a javascript function
<input type="radio" name="terriprod" value="D"
onclick="javascript:Verif(document.forms[0]);">D
and in the Verif function I try to submit the form but it does not work...

I have also tried:
I have then tried to add to the onclick event a javascript function
<input type="radio" name="terriprod" value="D" onclick="javascript:if
Verif(document.forms[0]) {document.forms[0].submit();};">D

But it does not work...

Can someone help me.

HDumas

Jul 23 '05 #2
HD
Hi and thanks but I have tried your suggestion...it does not work... it does
submit the form, but it does not go through the Verif function.
When the user clicks on the radio button, I need it to do the Verif function
and then submit the form.

..... I have Internet Explorer on Windows XP...
"lallous" <la*****@lgwm.org> a écrit dans le message de
news:30*************@uni-berlin.de...
Hello

Try this: <input type="radio" name="terriprod" value="D"
onclick="this.form.submit();">D

Anyway, the onclick events you added should work as well...What browser
you're using?
Perhaps you have other script errors in your page...

--
Elias
"HD" <du**@hotmail.com> wrote in message
news:Dn*********************@news20.bellglobal.com ...
Hi.

I have an asp page with radio buttons and a combobox... when the user
clicks
a radio button, I want the form to submit so I can execute the ASP code in order to change the list shown in the combobox... I have 2 radiobuttons:
<input type="radio" name="terriprod" value="E">E
<input type="radio" name="terriprod" value="D">D

I have tried adding an OnClick event to each of the radio button...
<input type="radio" name="terriprod" value="D"
onclick="javascript:document.forms[0].submit();">D
but it does not work...

I have then tried to put each of the radio button into an anchor...
<a href="javascript:document.forms[0].submit();"><input type="radio"
name="terriprod" value="D"></a>D
but it does not work...

I have then tried to add to the onclick event a javascript function
<input type="radio" name="terriprod" value="D"
onclick="javascript:Verif(document.forms[0]);">D
and in the Verif function I try to submit the form but it does not work...
I have also tried:
I have then tried to add to the onclick event a javascript function
<input type="radio" name="terriprod" value="D" onclick="javascript:if
Verif(document.forms[0]) {document.forms[0].submit();};">D

But it does not work...

Can someone help me.

HDumas


Jul 23 '05 #3
HD wrote:
Hi and thanks but I have tried your suggestion...it does not work... it does
submit the form, but it does not go through the Verif function.
When the user clicks on the radio button, I need it to do the Verif function
and then submit the form.
Then call the Verif function and let Verif submit the form.

<form onsubmit="Verif();return false">

And then in Verif, submit the form.
..... I have Internet Explorer on Windows XP...


And your point is?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #4
You haven't posted your HTML (or enough of it) so, a guess: this usually
happens when someone does this -

<input type="submit" name="submit" />

...which over-writes the Form.submit() method. If so, just name that
button something else.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #5
Rob B wrote:
You haven't posted your HTML (or enough of it) so, a guess: this usually
happens when someone does this -

<input type="submit" name="submit" />

...which over-writes the Form.submit() method. If so, just name that
button something else.


Let me quote part of the OP's response for you:

<quote>
Hi and thanks but I have tried your suggestion...it does not work... it
does submit the form, but it does not go through the Verif function.
</quote>

The form submits, but the form's onsubmit handler doesn't get called.
That is documented behavior. The solution, thats in my last post, is to
have the validation function submit the form and then call the
validation function onclick as well as onsubmit.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #6
Randy Webb wrote:
The form submits, but the form's onsubmit handler doesn't get called. That is documented behavior.

Thanks, I knew that - but where do you see, in the above, any trace of
an onsubmit handler (or a form tag, for that matter)?

Can you explain this:
I have then tried to add to the onclick event a javascript function
<input type="radio" name="terriprod" value="D"
onclick="javascript:Verif(document.forms[0]);">D
and in the Verif function I try to submit the form but it > does not work...
I have also tried:
I have then tried to add to the onclick event a javascript function
<input type="radio" name="terriprod" value="D" onclick="javascript:if
Verif(document.forms[0]) {document.forms[0].submit();};">D But it does not work...
As HDumas noted, they should have. The only way explicitly calling
Form.submit() will fail is if the method itself is over-written, a
common occurrence as a result of naming the submit button "submit". Yes,
I noticed he said "it does
submit the form..." but thought he might be mistaken as there is no
other likely explanation for the earlier observations.
The solution, thats in my last post...


Not necessarily the only one....

<form.....onsubmit="return Verif(this)">
<input type="radio" name="terriprod" value="E" />E
<input type="radio" name="terriprod" value="D"
onclick="if(Verif(this.form))this.form.submit()" />D
<input type="submit" />
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Carlo | last post by:
Hi I have three radio buttons where I need the user to select one of the buttons and its value must be emailed to me using the submit button. I'm using strBody = strBody & "<tr><td>Q1:" &...
15
by: JR | last post by:
Hi. I hope someone out there who is more versed with JavaScript than I can help me with the following annoying problem. Here's the problem. I have a form with the following layout: Column A...
4
by: Sjon | last post by:
Here's A piece of my code: <form action="dimensions.php" method="POST"> <br><input type="radio" style="background : #84c7e8" name="categorie" value="Customer" checked> Customer</br> <br><input...
4
by: houstoncity2004 | last post by:
Hi, I need help to JavaScript. I am new to this, and am trying to the page online ASAP. I have two submit buttons on one form, and each button will have to do different things. I named both...
8
by: shandain | last post by:
Ok, I have done this a million times, and I can't get this to work... I hope I am just being an idiot and missing something... but I can't see it... so please call me an idiot and tell me what it...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
2
by: Eli | last post by:
HI! I made some quiz using one HTML form (few question with few radio-button each like potential answers) that have one Submit button. I would like to simulate click on this button (e.g. named...
1
by: ansc1 | last post by:
Hello, I'm new to using php coding. I need help with the following: 1. There is a submit button on the form and is saves information to my database. After clicking on "Save Measurement" it...
4
by: FlaPnthrsPunk | last post by:
Hi all, this is my first time ever using PHP, and I am still very new to programming in general. I'm doing an assignment for my Media E-Commerce class where the code for a survey is all provided. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.