0

How can I disable the submit button with JAVA Script untill all the mandatory fieleds are filled? if any body can help.. its urgent please

3
Contributors
2
Replies
4
Views
10 Years
Discussion Span
Last Post by world_weapon
0

How can I disable the submit button with JAVA Script untill all the mandatory fieleds are filled? if any body can help.. its urgent please

Keep "Submit Button" Disbaled by default.

Then on each mandatory field put

onBlur="function();"

in this function write the code to check all the mandatory fileds are filled, if yes then enable your submit button or no keep disabled.

Call the same "function();" on each filed blur.

I hope this is clear.

Cheers...

0

You could try to write a function that will check each field for correctness and then use the form id to submit it with javascript. Instead of having a submit input use a button instead that onclick calls the function.

<script type="text/javascript">
function checkThenSubmitForm()
{
<!-- form checking instructions -->;
document.getElementById('theForm').submit();
return true;
}
</script>
<form id="theForm" action="whatever.php" method="post">
<!-- THE INPUT FIELDS -->
<input type="button" value="Submit" onclick="checkThenSubmitForm()">

I think thats right, but the idea is there.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.