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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

Display the SAVE button if ...

I need to show the Save Button only if document.form1.TotalTendered.value is greater than or equal to document.form1.InvoiceTotal.value.
0
drelinger
Asked:
drelinger
  • 2
  • 2
1 Solution
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
do you want to do this in asp or javascript? if its asp (meaning you have the value BEFORE the page loads), then it can be done quite easily
0
 
drelingerAuthor Commented:
I won't have the value before the page loads...
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
ok so it'll need to be done via javascript. this is untested but should work for you...

<script language="javascript">
   function displaySaveButton() {
       if( document.frm.TotalRendered.value != '' && document.frm.InvoiceTotal.value != '' ) {
           if( document.frm.TotalRendered.value >= document.frm.InvoiceTotal.value )
               document.getElementById('spnSaveButton').style.display = 'block';
           else
               document.getElementById('spnSaveButton').style.display = none';
       } else    //-- hide save button if both fields are blank
               document.getElementById('spnSaveButton').style.display = none';
   }
</script>

<form name="frm" method="post">
   <input type="text" name="TotalTendered" value="" onchange="return displaySaveButton();" />
   <input type="text" name="InvoiceTotal" value="" onchange="return displaySaveButton();" />

   <span id="spnSaveBtn" style="display:none;>
        <input type="submit" value="Save" />
   </span>
</form>
0
 
drelingerAuthor Commented:
...you got me there.. thank you...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now