Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

disactivate button submit if valueA<valueB

Posted on 2005-02-27
1
Medium Priority
?
171 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
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
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…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

580 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