/    Sign up×
Community /Pin to ProfileBookmark

Question with Submitting

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!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@fredmvDec 21.2003 — &lt;script type="text/javascript"&gt;
//&lt;![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;
}
//]]&gt;
&lt;/script&gt;
&lt;form action="#" onsubmit="return submitForm();"&gt;
&lt;input type="text" /&gt;
&lt;input type="submit" value="Submit" /&gt;
&lt;/form&gt;
Copy linkTweet thisAlerts:
@vbprog40authorDec 21.2003 — 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
Copy linkTweet thisAlerts:
@fredmvDec 21.2003 — 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 [font=courier]action[/font] attribute of the form and you'll be able to see it work.
×

Success!

Help @vbprog40 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...