943,733 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 8155
  • PHP RSS
Sep 5th, 2007
0

To disable Submit button

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rime is offline Offline
24 posts
since Aug 2007
Sep 5th, 2007
0

Re: To disable Submit button

Click to Expand / Collapse  Quote originally posted by rime ...
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
PHP Syntax (Toggle Plain Text)
  1. 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...
Reputation Points: 10
Solved Threads: 2
Light Poster
azzu5 is offline Offline
30 posts
since May 2007
Sep 15th, 2007
0

Re: To disable Submit button

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.
PHP Syntax (Toggle Plain Text)
  1. <script type="text/javascript">
  2. function checkThenSubmitForm()
  3. {
  4. <!-- form checking instructions -->;
  5. document.getElementById('theForm').submit();
  6. return true;
  7. }
  8. </script>
  9. <form id="theForm" action="whatever.php" method="post">
  10. <!-- THE INPUT FIELDS -->
  11. <input type="button" value="Submit" onclick="checkThenSubmitForm()">
I think thats right, but the idea is there.
Reputation Points: 21
Solved Threads: 2
Junior Poster in Training
world_weapon is offline Offline
63 posts
since Apr 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: chat system
Next Thread in PHP Forum Timeline: loopy doopy





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC