?
Solved

disactivate button submit if valueA<valueB

Posted on 2005-02-27
1
Medium Priority
?
163 Views
Last Modified: 2010-04-25
hello experts

i'm doing a small JSP-MYSQL project.

i have a payment page that displays a 'balAcc' and a 'total' field.

the 'balAcc' is from table reg while 'total' is from table svc.

i need to disactivate the submit button if the value of 'balAcc' is less than value of 'total'.

------------------------------------------------------------------------------------------------
if  the value of 'balAcc' is greater than 'total', the submit button is enabled and i need to display the total in a redirected page, together with date and time upon the user click on button submit.

the date and time is equals to the date and time the user clicked on the submit button.


please..please..please.. help. thanks in advance.
0
Comment
Question by:nurbahiyah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
Esopo earned 600 total points
ID: 13416316
Hi,

Try this:
****************************
<form name="form1" method="post" action="">
Total  <input type="text" name="T1" id="T1"><br>
Ammount  <input type="text" name="T2" id="T2" onKeyUp="CheckSubmit()"><br>
  <input type="submit" name="Submit" id="Submit" value="Submit" disabled>
<br>If total is = to ammount the submit button becomes enabled
</form>

<script language="JavaScript">
<!--
function CheckSubmit()
{
  if (document.getElementById('T1').value==document.getElementById('T2').value){
    document.getElementById('Submit').disabled=false;
  }else{
    document.getElementById('Submit').disabled=true;
  };
}
//-->
</script>
****************************

It uses getElementById to interact with the form controls. By using the DISABLED property of the submit button you can block the form from sending the info until the criteria is met.

This code will work in both IE and FireFox. Note that if your visitor don't support javascript, they won't be allowed to send the form.



>>i need to display the total in a redirected page, together with date and time<<
You should get the date/time info from the server. I suspect you are using PHP:
http://www.phptutorial.info/learn/datetime.html


Best regards,

Esopo.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question