Dear all,
I make forms for several events, but I've still one problem.
Example
If the person has clicked no, I want to 'submit' the form directly instead to go through the whole form and then Submit.
Can anyone help me
YLI
I make forms for several events, but I've still one problem.
Example
<tr>
<td align="right" width="57%"> I will Join the HPC Event:</span> </td>
<td width="40%">
<div>
<input type="radio" value="yes" name="event"> yes <input type="radio" value="no" name="event"> no</div>
</td>
If the person has clicked no, I want to 'submit' the form directly instead to go through the whole form and then Submit.
Can anyone help me
YLI
you can try:
and attach this to the onChange event of the radio!
Cheers
Max
if (document.getElementById('eventno').checked == true)document.getElementById('ChronoContact_formname').submit();
and attach this to the onChange event of the radio!
Cheers
Max
Hi Max,
Thanks for your reply. I've put the Onchange in the radio, but it doesn't work.
In the form are also validate-one-required fields. That maybe can give a problem??
Yvonne
Thanks for your reply. I've put the Onchange in the radio, but it doesn't work.
In the form are also validate-one-required fields. That maybe can give a problem??
Yvonne
<tr>
<td align="right" width="57%"> I will Join the HPC Event:</span> </td>
<td width="40%">
<div>
<input type="radio" value="yes" name="event">yes <input type="radio" value="no" name="event"
onchange="if (document.getElementById('eventno').checked == true)document.getElementById('ChronoContact_test_Yvonne').submit();"> no </div>
</td>
</tr>
Hi Yvonne,
I suspect that you need to add an id="eventno" to the tag so that the JavaScript can identify it
Bob
I suspect that you need to add an id="eventno" to the tag so that the JavaScript can identify it
<input type="radio" value="no" name="event" id="eventno"
onchange="if (document.getElementById('eventno').checked == true) document.getElementById('ChronoContact_test_Yvonne').submit();" />
Bob
Hi Bob,
It works!
The form has some required values, i.e. surname (see example).
Starting the form and the user clicks directy "Join the event " 'no'. the form will be submitted immediately.
We don't know the name of the user who filled in the form. Is there a solution, that the user then will be forced to enter his surname? i.e. if surname=" " then .....
Gr. Yvonne
It works!
The form has some required values, i.e. surname (see example).
Starting the form and the user clicks directy "Join the event " 'no'. the form will be submitted immediately.
We don't know the name of the user who filled in the form. Is there a solution, that the user then will be forced to enter his surname? i.e. if surname=" " then .....
Gr. Yvonne
<tr>
<td align="right" height="25" width="57%"> First name: </td>
<td width="40%"><input size="30" name="firstname"></td>
</tr>
<tr>
<td align="right" height="25" width="57%">Surname: </td>
<td width="40%"><input size="30" name="surname"></td>
</tr>
<tr>
<td align="right" height="25" width="57%">Email: </td>
<td width="40%"><input size="30" name="email"></td>
</tr>
<tr>
<td align="right" width="57%"><font color="white">,</font> </td>
<td width="40%"> </td>
</tr>
<tr>
<td align="right" width="57%"> I will Join the HPC Event:</span> </td>
<td width="40%">
<div>
<input type="radio" value="yes" name="event"> yes <input type="radio" value="no" id="eventno" name="event"
onchange="if (document.getElementById('eventno').checked == true)document.getElementById('ChronoContact_test_Yvonne').submit();"/> no </div>
</td>
</tr>
try to check for the surname field data, it depends on the logic you need.
Max
Max
It's necessary to know email or surname of the user who only has checked the 'no' button (Join event 'no') and nothing else in the form.
In my example the form will be submitted by clicking the 'no' button immediately.
I only want to have a check if a surname or email is not filled in, and then have the possibilty for the user to fill in email and then de form will be submitted.
Yvonne
In my example the form will be submitted by clicking the 'no' button immediately.
I only want to have a check if a surname or email is not filled in, and then have the possibilty for the user to fill in email and then de form will be submitted.
Yvonne
Hi Yvonne,
try this :
this code may need to be enhanced alittle but I leave this to you!
Cheers,
Max
try this :
<input type="radio" value="no" name="event" id="eventno"
onchange="if ((document.getElementById('eventno').checked == true)&&(document.getElementById('surname').value != '')){ document.getElementById('ChronoContact_test_Yvonne').submit();}else{alert('Enter surname');}" />
this code may need to be enhanced alittle but I leave this to you!
Cheers,
Max
Hi Max,
Thanks, it works fine.
Is it possible, after starting the form and I click immediately "Join the event ' no'", the alert appears and I fill in my email, to let submit the form immediately.
After I've filled in my email, I've to click first 'Join the event ' yes' and then click no, and the form submits.
Gr. Yvonne
Thanks, it works fine.
Is it possible, after starting the form and I click immediately "Join the event ' no'", the alert appears and I fill in my email, to let submit the form immediately.
After I've filled in my email, I've to click first 'Join the event ' yes' and then click no, and the form submits.
Gr. Yvonne
<form name="Yvonne" action="" method="post">
<table id="table" CELLSPACING="2" width="85%" border="0" CELLPADDING="5" Cellspacing="5">
<tr>
<td colspan="2">
<p align="center"><b><font color="blue" size="5">Proef111</font> </b></p>
</td>
</tr>
<tr>
<td align="right" height="25" width="57%">Surname: </td>
<td width="40%"><input size="30" id="surname" name="surname"></td>
</tr>
<tr>
<td align="right" height="25" width="57%">Email: </td>
<td width="40%"><input size="30" id="email" name="email"></td>
</tr>
<tr>
<td align="right" width="57%"> I will join: </td>
<td width="40%">
<div>
<input type="radio" value="yes" name="events"> yes <input type="radio" value="no" name="events" id="eventno"
onchange="if ((document.getElementById('eventno').checked == true)&&(document.getElementById('email').value != '')){ document.getElementById('ChronoContact_Proef112').submit();}else{alert('Enter email');}" /></div>
</td>
</tr>
</table><br>
<p align="center"><input type="submit" value="Send" name="Send"><input type="reset" value="Reset" name="Reset"></p>
</form>
Hi Yvonne,
first remove the form tags from your code!
2nd, you can do what you need if you attached an onchange event to the email box too, use the same logic i used!
Cheers,
Max
first remove the form tags from your code!
2nd, you can do what you need if you attached an onchange event to the email box too, use the same logic i used!
Cheers,
Max
This topic is locked and no more replies can be posted.