compare text box values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • parshupooja
    New Member
    • Jun 2007
    • 159

    compare text box values

    Hey all I have two text boxes. I want to show message if text box1 value is not equal to textbox2

    I have written this but it does not work


    [code=java]function ValidatePost()
    {

    if(document.get ElementById("<% =txtsign.Client ID%>").value != document.getEle mentById("<%=tx tId.ClientID%>" ).value)
    {
    alert("-------------------------");
    document.getEle mentById("<%=tx tsign.ClientID% >").focus();
    return false;
    }
    }[/code]
    thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    How is this function called?

    Comment

    • parshupooja
      New Member
      • Jun 2007
      • 159

      #3
      on change on of textbox1. textbox 2 gets value by itself on page load, so when user enter value in textbox 1 I want trigger validation.

      thanks

      Originally posted by acoder
      How is this function called?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by parshupooja
        on change on of textbox1. textbox 2 gets value by itself on page load, so when user enter value in textbox 1 I want trigger validation.

        thanks
        So, is it something like:
        [html]<input type="text" name="txtsign" id="somethingOr Other" onchange="Valid atePost()">[/html]

        Just a note: please don't top-post. Thanks!

        Comment

        • parshupooja
          New Member
          • Jun 2007
          • 159

          #5
          yes, i guess thats how it shd be, but it still does not work

          Originally posted by acoder
          So, is it something like:
          [html]<input type="text" name="txtsign" id="somethingOr Other" onchange="Valid atePost()">[/html]

          Just a note: please don't top-post. Thanks!
          Last edited by parshupooja; Jan 28 '08, 11:49 PM. Reason: err

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Have you checked that the IDs of the textboxes match with those used in the function? Are there any errors? If not, post your full code (if it's not too much) or a link to a test page.

            Comment

            Working...