disactivate button submit if valueA<valueB

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.
nurbahiyahAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EsopoCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.