View Full Version : Disable/Enable button

08-01-2002, 05:47 PM
How do i make an button that you need to klick and then when you click it it will "unlock"/enable the next button??

Please help!

08-01-2002, 06:04 PM
I would track it through a variable. Once they click the first button, the set the flag to true. Then on selecting the second button make sure the flag is true before it does whatever it is going to do.

<script language="javascript" type="text/javascript">
submitOK = false
function SetConfirm(){
submitOK = true;
document.temp.confirm.value = "Confirmed";
document.temp.submit1.value = "Submit";

function checkSubmit(){

<form name="temp">
<input type="button" name="confirm" value="Click To Confirm" onClick="SetConfirm()"><br>
<input type="button" name="submit1" value="Must Confirm" onClick="checkSubmit()">

In that case, there is a visual cue that they did indeed select the button, and submit will work.


08-01-2002, 09:12 PM
But can you make the buttons to images, i know hot to mak an image button but it didn't work with the script!!

my img code:
<img border="0" src="img/bottom.gif" width="500" height="13">

08-01-2002, 10:49 PM
Images also support onClicks... you will have to remove this bit

document.temp.confirm.value = "Confirmed";
document.temp.submit1.value = "Submit";

that changes the button values, or you will get an error.

<img border="0" src="img/bottom.gif" width="500" height="13" onClick="SetConfirm()>
<img border="0" src="img/bottom2.gif" width="500" height="13" onClick="checkSubmit()>