Jump to content

[SOLVED] Disable / Enable Image link??


mikey3521

Recommended Posts

Hello. I have an image link on my page that is a button that will send a payment to payment gateway.

Now I don't want them to be able to click it unless they put a checkmark in the box that says that've read and understand the TOA

 

Is there anyway to have the image disabled by default..

BUT once they put a check in the checkbox it enables it

but if they uncheck it re disables it?

 

Thanks

-Mike

Link to comment
Share on other sites

this should do the trick:

 


<script language="javascript">

function errorMsg()
{
alert("You Must Agree To My TOS Agreement To Proceed");
}

function go2pg()
{
document.getElementById('ticket').href="payment_gateway.php";
document.getElementById('tos').onclick=function() {
donotgo2pg();
}
}

function donotgo2pg()
{
document.getElementById('ticket').href="javascript:errorMsg()";
document.getElementById('tos').onclick=function() {
go2pg();
}
}

</script>

<form>

<input id="tos" type="checkbox" onclick="go2pg()"> I Agree To Your TOS Agreement

</form>

<a id="ticket" href="javascript:errorMsg()"><img src="gateway_submission.jpg" width="100" height="30" border=0 alt="Pay Now"></a>

Link to comment
Share on other sites

Thank you very much. Though I still need a bit more to get there, I've got the basic idea of what's going on but the image I want to disable is actually the submit button. let me show you the code..

 

<input type=hidden name="testmode" value="on" />	
<input type="checkbox" name="tos" value="ON">Agree?
<input type=hidden name="merchantAccount" value="omitted">
<input type=hidden name="amount" value="399.99">
<input type=hidden name="item_id" value="testproduct">
<input type=image disabled name="cartImage" id="cartImage" src="http://solidtrustpay.com/images/buttons/buttontinySTP.gif">
</form>

 

so basically if theres a checkbox in that TOS then i'll be able to click on the image, (submit input type, last line) if there is no check box, it's disabled (as it is now)... thoughts?

Link to comment
Share on other sites

see how this works out for you:

 


<script language="javascript">

function check4check()
{
if (document.processor.tos.checked != true)
{
  document.getElementById('cartImage').disabled = true;
}
else
{
  document.getElementById('cartImage').disabled = false;
}
}

</script>

<form name="processor" action="process_gateway.php" method="post">
<input type=hidden name="testmode" value="on" />	
<input type="checkbox" name="tos" value="on" onclick="check4check()">Agree?
<input type=hidden name="merchantAccount" value="omitted">
<input type=hidden name="amount" value="399.99">
<input type=hidden name="item_id" value="testproduct">
<input type=image disabled name="cartImagepic" id="cartImage" src="http://solidtrustpay.com/images/buttons/buttontinySTP.gif">
</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.