Forum Moderators: open

Message Too Old, No Replies

Need to disable submit button After Clicking Ok Button.

         

srins

2:46 pm on Apr 18, 2007 (gmt 0)

10+ Year Member



Hi All,

Here i am facing some problem in disabling the submit button.

The sitaution is :
------------------
Once we click on submit button, i was asking confirmation from user as ok / cancel.

After clicking on Ok,
I should disable submit button to prevent any more submits for the form.

I did some work around over these.After disabling the button, the form is not submitting.

Here the code sniplet i am using .

At : Java Script

function makeVisible(button)
{
if( confirmSubmit())
{
element = document.getElementById(button);
//alert(element);
element.style.visibility = "visible";
document.submitJob.disabled=true;
return true;
}else return false;
}

at html :

<html:submit property="action" onclick="return makeVisible('picture');">"
title="Execute" styleClass="submitLink" styleId="submitJob" >

.......

Here i should first submit and disable .

can any help me in this regard.

Thanks
Srins.

Fotiman

3:22 pm on Apr 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try this script instead:


function makeVisible(button)
{
if( confirmSubmit() ) {
var element = document.getElementById(button);
if( element ) {
element.style.visibility = "visible";
}
var submitJob = document.getElementById('submitJob');
if( submitJob ) {
submitJob.disabled=true;
}
return true;
}
else {
return false;
}
}

Note, I added some error checking and also get the submit button to disable using getElementById.