Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    May 2018
    Posts
    2
    Member #
    59011

    Making a submit button only submit if a certain radio box is checked.

    Hi,

    So i have 2 radio boxes: one that says yes, and the other that says no..

    how do i make the submit button only submit (go to a certain link) when the yes radio box is selected... if none, or the no radio box is selected i want an alert/message to pop up saying that they cannot proceed unless they select yes...

    here is my html code...

    HTML Code:
                   <form method="post" target="">
                        <input type="radio" name="mandatory" value="0">
                                	 <div class="bold">
                                         Yes, my order is for the Camarillo location.
                                	  </div> <br />
                         <input type="radio" name="mandatory" value="1">
                                	No, I want to place my online order for the <br />Ventura or Port Huneme location. <br />
                         <input type="submit" class="submit" value="START MY ONLINE ORDER NOW" title="click here to start your online order, CAMARILLO STORE ONLY">
                     </form>

    I have three restaurant locations, and i just started offering online ordering at only one location, but people keep trying to order for the other two, so i in order for them to goto the online ordering website, i only want them to be able to click the link (have it work) if they selected yes, they are ordering from the camarillo store.


    i beleive i need javascript to do this , but its been years since ive used it, and i couldnt find the solution i needed online..

    any help would be greatly appreciated, thanks in advance!

  2.  

  3. #2
    Junior Member
    Join Date
    May 2018
    Posts
    2
    Member #
    59011

    solved my own question...

    i figured out how to do it after antoher 5 hours of research.. just incase anyone else wants to know...

    Code:
    function gotoOnlineOrderSite(){
    	var mustChooseOne;
    	var cantOrderFromHere
    	
    	if(document.getElementById('yesCam').checked) {
      		window.open("http://onlinesite/", "_blank");
    	}
    	else if(document.getElementById('noCam').checked) {
    		cantOrderFromHere = "Ventura and Port Huneme do not offer online orderering at this time.  If you'd like to place an online order, it will have to be for our Camarillo Location."
    		document.getElementById("mustChoose").innerHTML = cantOrderFromHere;
    	}
    	else {
    		mustChooseOne = "You must make a selection above before proceeding."
    		document.getElementById("mustChoose").innerHTML = mustChooseOne;
    	}
    	
    }


    Quote Originally Posted by jgray View Post
    Hi,

    So i have 2 radio boxes: one that says yes, and the other that says no..

    how do i make the submit button only submit (go to a certain link) when the yes radio box is selected... if none, or the no radio box is selected i want an alert/message to pop up saying that they cannot proceed unless they select yes...

    here is my html code...

    HTML Code:
                   <form method="post" target="">
                        <input type="radio" name="mandatory" value="0">
                                	 <div class="bold">
                                         Yes, my order is for the Camarillo location.
                                	  </div> <br />
                         <input type="radio" name="mandatory" value="1">
                                	No, I want to place my online order for the <br />Ventura or Port Huneme location. <br />
                         <input type="submit" class="submit" value="START MY ONLINE ORDER NOW" title="click here to start your online order, CAMARILLO STORE ONLY">
                     </form>

    I have three restaurant locations, and i just started offering online ordering at only one location, but people keep trying to order for the other two, so i in order for them to goto the online ordering website, i only want them to be able to click the link (have it work) if they selected yes, they are ordering from the camarillo store.


    i beleive i need javascript to do this , but its been years since ive used it, and i couldnt find the solution i needed online..

    any help would be greatly appreciated, thanks in advance!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:38 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com