To disable Submit button

Reply

Join Date: Aug 2007
Posts: 24
Reputation: rime is an unknown quantity at this point 
Solved Threads: 0
rime rime is offline Offline
Newbie Poster

To disable Submit button

 
0
  #1
Sep 5th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 30
Reputation: azzu5 is an unknown quantity at this point 
Solved Threads: 2
azzu5 azzu5 is offline Offline
Light Poster

Re: To disable Submit button

 
0
  #2
Sep 5th, 2007
Originally Posted by rime View 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
Keep "Submit Button" Disbaled by default.

Then on each mandatory field put
  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...
Looking at my own code of Life and thinking what the hell is this....
------------------------------------
Middle East B2B Marketplace
Dubai Web Design
Dubai SEO
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 59
Reputation: world_weapon is an unknown quantity at this point 
Solved Threads: 2
world_weapon's Avatar
world_weapon world_weapon is offline Offline
Junior Poster in Training

Re: To disable Submit button

 
0
  #3
Sep 15th, 2007
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.
  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.
The purpose of my existence is why I am here.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC