Compare Form item to database item [Answered]RSS

1 reply

Last post Aug 05, 2012 12:33 AM by Ken Schaefer

  • Compare Form item to database item

    Aug 02, 2012 05:47 PM|tim8w|LINK

    Hi,

    I need to be able to compare a forms item to a database field item. I have a Form with the following table:

                <table width="95%"  border="1" align="center" bgcolor="#EEEEEE">
                  <tr>
          <td class="RequiredField">Select a Shipper:</td>
        <td colspan="3"><select name="Shippers<%=(x)%>" id="Shippers<%=(x)%>" onChange="Shippers_Change(<%=(x)%>)">
         <%
    While (NOT Shippers.EOF)
         If ( Shippers.Fields.Item("ContentOwnerID").Value = document.EntryForm.ContentOwnerID.value ) Then
    %>
         <option value="<%=(Shippers.Fields.Item("ShipperId").Value)%>"><%=(Shippers.Fields.Item("ShipperNumber").Value)%></option>
    <%
         End If
      Shippers.MoveNext()
    Wend
    If (Shippers.CursorType > 0) Then
      Shippers.MoveFirst
    Else
      Shippers.Requery
    End If
    %>
        </select>&nbsp;

    The lines in bold is what I want to do, but it is not working. Is my only option to post and get the form value back in order to compare it to the database value?

    Thanks,

    Tim

  • Re: Compare Form item to database item

    Aug 05, 2012 12:33 AM|Ken Schaefer|LINK

    ASP runs entirely on the server (hence Active Server Pages). It doesn't know anything about the values that a user has filled into a form.

    So, you have two options:
    a) do a form submit (POST or GET) to send the values back to the server
    b) use AJAX to send the values back to the server asynchronously

    Only then will the server have this data, and your ASP code will be able to do something.