HTML Form Validation Help, HTML Code Help |
HTML Form Validation Help, HTML Code Help |
SamCaunt |
Nov 29 2016, 04:29 AM
Post
#1
|
Group: Members Posts: 1 Joined: 29-November 16 Member No.: 24,945 |
Hi All,
At the minute my code validates whether the checkbox is checked, if its not checked it returns a message. When the checkbox is checked and my user hits the "Accept" button I want to then run a function in java how do I do this???. Many Thanks Sam QUOTE <center><form> <input type="checkbox" name="checkbox" value="check" /> I accept the terms and conditions <p align=center><input type="button" name="Submit" value="Accept" class="button" onclick="if(!this.form.checkbox.checked){alert('You must agree to the terms first.');return false}" /></p> <p align=center><input type="button" name="Reject" value="Reject" class="button" onclick="reject();"></p> </form></center> |
pandy |
Nov 29 2016, 08:05 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,732 Joined: 9-August 06 Member No.: 6 |
What function? Surely not the same as when the checkbox isn't checked?
You can can add an else statement the triggers when the if condition is not met. CODE onclick="if(!this.form.checkbox.checked){alert('You must agree to the terms first.');return false}else{alert('Whatever');}" |
Lo-Fi Version | Time is now: 26th April 2024 - 06:22 PM |