prefills

bb's Avatar

bb

21 May, 2012 05:40 PM

i would like to prefill my auto suggest box with data queried from my database. It is not working can you help me. attached is my code:

Select a Picture:<br />
<%
sqlPictures = "SELECT filePath, imageID FROM images GROUP BY filepath  "
set rsPictures = conn.execute(sqlPictures) 
Do While Not rsPictures.EOF

    sql="SELECT i.itemID, i.Name FROM items i INNER JOIN ImageToItem iti ON iti.ItemID = i.ItemID WHERE iti.ImageID =" & rsPictures("imageID")
    set rsItems = conn.execute(sql)
    strJasonBatch = "" 'each time we should start with a clean string 
    If not rsItems.EOF Then 
         dim JSON_String : set JSON_String = pmJSON.createObject()                  

        JSON_String.set "value", rsItems("ItemID")&""
        JSON_String.set "name", rsItems("Name")&""
        myJSON = pmJSON.stringify(JSON_String, null, 2)
        strJasonBatch = strJasonBatch & Delim(strJasonBatch,",") & myJSON
        rsItems.moveNext

    End If%>

    <%=rsPictures("FilePath")  %>
    <input type="hidden" name="ImageId" value="<%=rsPictures("imageID") %>" />
    <input class="autoText" id="<%=rsPictures("imageID") %>" jsonPrefil='<%="["&strJasonBatch&"]"%>' name="products_<%=rsPictures("imageID") %>" type="text" size="30" />
    <br />
    <%rsPictures.MoveNext
 Loop  
 rsPictures.close
%>
<br />
<input type="submit" name="submitPics" value="Submit Pictures">
  1. 1 Posted by bb on 21 May, 2012 05:42 PM

    bb's Avatar

    please let me know why my auto suggest box is not being populated with my query

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac