Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This script is not working correct format.it is first time working correctly . after then not working correct format.help me




VB
<asp:RadioButton ID="rdbCre" runat="server" CssClass="normalText" Text="Credit "
                                                                            AutoPostBack="true" onclick="javascript:return hideloader()"  />


<asp:TextBox ID="txtAmount" runat="server" />


C#
function hideloader() {
    //$find('mpeLoader').show();
    //document.getElementById('ctl00_cplhlderTransaction_rblCreBank_0').checked = false;
    //document.getElementById('ctl00_cplhlderTransaction_rblCreBank_1').checked = false;

    var lblAmountInfordo = document.getElementById("<%=Error.ClientID %>");
    if (lblAmountInfordo != null) {
        lblAmountInfordo.innerHTML = "";
    }

    var chktxtAmount = document.getElementById("<%=txtAmount.ClientID %>").value;

    if (document.getElementById("<%=txtAmount.ClientID %>").value == "") {
        if (chktxtAmount != null) {
            document.getElementById("<%=txtAmount.ClientID %>").focus();
            lblAmountInfordo.innerHTML = "Please Enter amount";

            return false;
        }
    }


    var chkminamt = document.getElementById("<%=txtAmount.ClientID %>").value;

    if (document.getElementById("<%=txtAmount.ClientID %>").value < 5000) {
        if (chkminamt != null) {
            document.getElementById("<%=txtAmount.ClientID %>").focus();
            lblAmountInfordo.innerHTML = "Amount Should be Minimum र 5000";
            return false;
        }
    }
Posted

Discard return keyword as follows. it would work fine

onclick='javascript:hideloader()'/>
 
Share this answer
 
try this code

HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

    <script type="text/javascript">



 function hideloader() {

var lblAmountInfordo = document.getElementById("<%=Error.ClientID %>");
var chktxtAmount = document.getElementById("<%=txtAmount.ClientID %>").value;
            
            
            if (lblAmountInfordo != null) {
                lblAmountInfordo.innerHTML = "";
            }

            if (chktxtAmount == "") {
                if (chktxtAmount != null) {
                    document.getElementById("<%=txtAmount.ClientID %>").focus();
                    lblAmountInfordo.innerHTML = "Please Enter amount";

                    return false;
                }
            }

            if (chktxtAmount < 5000) {
                if (chktxtAmount != null) {
                    document.getElementById("<%=txtAmount.ClientID %>").focus();
                    lblAmountInfordo.innerHTML = "Amount Should be Minimum र 5000";
                    return false;
                }
            }
        }
    
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:textbox id="txtAmount" onblur="javascript:hideloader();" runat="server"  />
        <br /><hr />
        <asp:radiobutton id="rdbCre" runat="server" cssclass="normalText" text="Credit " >
            AutoPostBack="false" />
            <br />
            
            <asp:label id="Error" text="" runat="server"></asp:label>
    </asp:radiobutton></div>
    </form>
</body>

Vote or Accept solution
If this will help you
thanks

</html>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900