Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compare Dropdown and textbox validation

    Hi,
    I need my users to choose a value from the dropdown and type the same value on the textbox. This is the code that I am using and getting an error even if I type the same value. HELP please.

    <form action="insert_add_prod.asp" method="post" name="add_prod" id="add_prod" OnSubmit="return ValidateFields(this)">

    <select name="prod_id" id="prod_id" >
    <%
    'Execute your Query using MyConnection
    Do Until Myrs.eof
    %>
    <option value="<% = Myrs.Fields("item_id") %> ">
    <% = Myrs.Fields("item_id") %>
    </option>
    <%
    'Move to the next record
    Myrs.movenext
    loop
    %>
    </select>

    Is that a problem? This is the code I am using to validate;

    else if(document.add_prod.prod_id.options[document.add_prod.prod_id.selectedIndex].value != document.add_prod.prod_id_chk.value )
    {
    alert("Please enter same Product ID.");
    document.add_prod.prod_id_chk.focus();
    return false;

    }

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts

    Re: Compare Dropdown and textbox validation

    Originally posted by ashok_19
    <option value="<% = Myrs.Fields("item_id") %> ">
    your values end with a space this way, is that what you are overseeing?
    probably it should be
    <option value="<% = Myrs.Fields("item_id") %>">
    I am the luckiest man in the world


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •