SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Aug 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool Need to compare database value to form value

    Is there a simple way to compare a current value in a form element to a database value?

    I want to populate a popup based on what the user selected in the current, non-posted form. Here's what I want to do:

    <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 comaprison I want to do is in bold...

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anything to do with pop-ups is clientside coding . Sounds like you want to use AJAX which captures the user's choice on the client side, passes the value to the asp file on the server to make a comparison and retrieves the result to be displayed in a pop-up box.

    Do a search for jQuery Ajax form validation and you should find some examples which will meet your needs

  3. #3
    SitePoint Member
    Join Date
    Aug 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    webber123456,
    I have already made a query and have the database values in a cursor. I would like to compare the client side valut to the already retrieved database values and build a Ppopup. I don't want to have to requery the server if at all possible...

  4. #4
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you already have everything you need from the server then the rest of your coding is in the clientside using javascript. ASP is no longer part of the solution.

    I suggest posting the question of clientside comparison/pop-ups in a javascript forum, those guys do that stuff all day long.


Bookmarks

Posting Permissions

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