Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6938055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:26:35+00:00 2026-05-27T12:26:35+00:00

I have a field named GROSS AMOUNT If the gross amount is zero, then

  • 0

I have a field named “GROSS AMOUNT”

If the gross amount is zero, then the javascript message confirmation asks the user whether the user should continue saving with zero amount and if the user presses cancel, even the server side save button should not be active, it should return back to the panel of the gross amount.

I have used the following code for the client side.

function show_confirm() {

    // var txttemp = document.getElementById("<%=txtSAmt.ClientID %>").value;
    var menu = $find("<%= this.txtSAmt.ClientID %>");
    var check;
    if (menu != null) {
        check = menu.get_value();
    }
    if (check == '0') {
        var r = window.confirm("Gross Settlement Amount is 0.Press Cancel to Change, Press OK to save anyway");
        if (r == 'false') {

        }

    }

}

Please let me know that if the client clicks cancel, it should not fire the btnSave on the server side.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:26:35+00:00Added an answer on May 27, 2026 at 12:26 pm

    I assume this is an event handler for the onclick event of btnSave.

    First, r will never equal "false" because confirm() returns a boolean, not a string. You need to compare r to false (without quotes). Actually, you don’t need to compare r to anything since r is already a boolean. So r == false is the same as !r.

    You can use e.preventDefault(). You’ll need to add the e parameter to your function definition:

    function  show_confirm (e) {
        e = e || window.event;
        ...
        if (check == '0') {
            var r = window.confirm("...");  
            if (!r) {
                if (e.preventDefault) {
                    e.preventDefault();
                }
                e.returnValue = false;
            }  
        }  
    }
    

    If you are calling show_confirm() like this:

    <asp:button ... OnClientClick="show_confirm()" />
    

    You’ll need to change that to pass the event object:

    <asp:button ... OnClientClick="show_confirm(event)" />
    

    Alternatively, you can just return false from your event handler. Again, if you are calling show_confirm() as above, you’ll need to change it to:

    <asp:button ... OnClientClick="return show_confirm()" />
    

    You can change your function to this:

    function show_confirm() {
        var menu = $find("<%= this.txtSAmt.ClientID %>");
        var check;
        if (menu != null) {
            check = menu.get_value();
        }
        return check != "0" || !confirm("Gross Settlement Amount is 0. Press Cancel to Change, Press OK to save anyway.");
    }           
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As I'm working on C#, I have one field named 'Amount'. double amount =
I my index lets say I have field field named full_name. I'm doing following
i have table called as Support, which have a field named Name and contains
Right now, I have a database field named 'PROCESS_FLAG' that contains the text value
i have a nvarchar(max) field named PublishTime, which contains the time in HH:MMtt (10:20AM),
I have a table with statistics and a field named time with Unix Timestamps.
I have a ModelForm where one of the field (named creator ) is a
I have a calendar table in my MYSQL database with one field named datefield
I have a field named tag. And it contains following data: tags a-b-c-d-e--12-f a-b
In my table I have a field named eventdate in datetime format like 2010-05-11

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.