User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 426,475 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,237 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2622 | Replies: 2
Reply
Join Date: Aug 2007
Posts: 21
Reputation: rime is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rime rime is offline Offline
Newbie Poster

Help To disable Submit button

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2007
Posts: 30
Reputation: azzu5 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
azzu5 azzu5 is offline Offline
Light Poster

Re: To disable Submit button

  #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
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  
Join Date: Apr 2004
Location: Brownsville or Austin, TX or Faber, VA
Posts: 59
Reputation: world_weapon is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
world_weapon's Avatar
world_weapon world_weapon is offline Offline
Junior Poster in Training

Re: To disable Submit button

  #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.
<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.
The purpose of my existence is why I am here.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 4:00 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC