i have two radio buttons: 'Accept' and 'Don't Accept'

if the 'Accept' radio is not checked when the form gets submitted i would like the page to reload without sending any info...

<form id="form1" name="form1" method="post" action="PaymentFormProcess.php">
    <table width="80%" align="center">
      <tr>
        <td width="43%"><strong>Do you accept these terms and conditions?</strong></td>
        <td width="29%" align="right"><p>
          <label>
            <input type="radio" name="TermsConditions" value="Accept" id="TermsConditions_0" />
            I Accept</label>          
        </p></td>
        <td width="28%" align="right"><label>
          <input type="radio" name="TermsConditions" checked="checked" value="Decline" id="TermsConditions_1" />
          I do not Accept</label>
        </td>
      </tr>
    </table>

<label for="ConfirmBooking">Confirm Booking:</label>
            <input type="submit" name="ConfirmBooking" id="ConfirmBooking" value="Confirm Booking" onclick="Accept()" />
</form>
function Accept()
{	
	if(!document.getElementById('TermsConditions_0').checked == true)
	{
		alert("You must Accept terms before booking can be made");
		//window.location.reload(true);//window.location.reload(); 
		window.location.href= 'http://Payment.php';//window.location.href
	}
}

none of the above work...

can anyone help please????????

Just set type="button"

<input type="BUTTON" name="ConfirmBooking" id="ConfirmBooking" value="Confirm Booking" onclick="Accept()" />

When using input for buttons, use onClick event for type="button" and onSubmit for type="submit"(in this case, the listener must return false for canceling the submit).

Hope it helps.

remove onclick from submit button.
in FORM tag use onSubmit="return checkaccept();"

function checkaccept(){
 if(!document.getElementById('TermsConditions_0').checked == true){
 alert("You must Accept terms before booking can be made");
 return false;
}else{return true;}
}

shot vsmash worked like a charm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.