Display the SAVE button if ...

Posted on 2011-05-11
Last Modified: 2012-05-11
I need to show the Save Button only if document.form1.TotalTendered.value is greater than or equal to document.form1.InvoiceTotal.value.
Question by:drelinger
    LVL 32

    Expert Comment

    by:Big Monty
    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

    Author Comment

    I won't have the value before the page loads...
    LVL 32

    Accepted Solution

    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';
                   document.getElementById('spnSaveButton').style.display = none';
           } else    //-- hide save button if both fields are blank
                   document.getElementById('spnSaveButton').style.display = none';

    <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" />

    Author Closing Comment

    by:drelinger got me there.. thank you...

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now