SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    germany
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic Checkbox with database help needed urgently

    Hello
    i have list of items as a list.Now user can select any item in that list.
    Now what i do is create checkboxes to enable user to check the item which has to be selected.

    1. Checkboxes are dynamic.
    2. I create checkboxes with one name assign value = Itemcode value so that when form is submitted i can get the itemcode value as a comma seperated list and which would be easy for me to put it in a database query.

    3. the part i have problem is i have to display those checkboxes ticked back to user , ie after form submit i have to make the checkbox which are previously checked, to be in checked state.
    request.form("Chkgroup")="1,4,5,6,9,10"
    assume this is an arrray i am getting from form element.what is the easiest and efficient method so that i can make those checkbox checked again.
    i tried instring but was a failiure.
    need help urgently
    with regards
    vimal
    Knowledge is all about Sharing

  2. #2
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Kingston
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    InString will work if you do a little juggling.

    chkSubmitted = "," & request.form("Chkgroup") & ","
    then when printing the checkbox back to the screen (assuming i is your dynamic value) ...


    <input type="checkbox" value="<%=i%>" <%if instr(chkSubmitted,"," & i & "," then%>checked<%end if%>>
    Hope that works for you.


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
  •