Click to See Complete Forum and Search --> : Question with Submitting


vbprog40
12-21-2003, 01:08 AM
I have a submit button that when clicked ask you wether you really want to do it....OK/CANCEL...
<script LANGUAGE="JavaScript">
<!--
function confirmSubmit()
{
var agree=confirm("Are you sure");
if (agree)
return true ;
else
return false ;
}
// -->
</script>

But I also want to add this ..

function submitCheck(){
document.Zip.B1.value = 'Sending Email....Please Wait';
document.Zip.B1.disabled = true;
}

So if my submit button is:
<form name="Zip">
<input type="submit" value="Submit Form" onClick="return confirmSubmit()" name="B1">
</form>

SO my question is...how do I join these to codes so if you click OK to submit it will change the value and disable B1?

Thanks Alot!

fredmv
12-21-2003, 01:17 AM
<script type="text/javascript">
//<![CDATA[
function submitForm()
{
if(confirm('Are you sure you want to submit the form?'))
{
with(document.forms[0][1])
{
value = 'Please wait, submitting...';
disabled = true;
}
return true;
}
return false;
}
//]]>
</script><form action="#" onsubmit="return submitForm();">
<input type="text" />
<input type="submit" value="Submit" />
</form>

vbprog40
12-21-2003, 03:35 PM
I tryed that code, It asked "Are you sure..." corfirm thing but when clicked OK it didn't disable the button and change the value


THanks

fredmv
12-21-2003, 04:00 PM
It worked fine for me. I'm guessing it just happened so fast that you don't actually notice it. Try uploading it and providing a real server-side script for the action attribute of the form and you'll be able to see it work.