Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    auto-listing all Form elements

    This should be easy but I'm not getting *quite* what I want. I am developing a rather hairy, as in complex, html form and need to start writing a back end db for it. This form is going to contain multitudes of things that need to map to the db fields. what i'd like to do is slap together some quick asp or javascript or something that can go thru the form and tell me the NAME of all the items. I can get the various drop-downs and textboxes and the submit button using this code:

    <--

    For Each Item In Request.Form
    Response.Write(Item) & "<b r>"
    Next

    -->
    but all my checkboxes are skipped. there's a lot of them and I want to avoid spelling mistakes in the db and want to be lazy and want to cut-and paste.

    Any ideas?

    TIA

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: auto-listing all Form elements

    Can you paste some examples of your HTML code on the form page? Without seeing the code it's hard to tell what the issue could be.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: auto-listing all Form elements

    I could but it'd be boring. I have a table with various checkboxes such as:

    <td width="24%" style="border-style: solid; border-width: 2">

    <input type="checkbox" name="Private_Attendance" value="ON">Private Organization

    </td>

    Just generic checkbox, input boxs, drop-down boxes, etc. Furthermore, I have a dynamically-generated table on another page that writes a table base on the number of lines needed to input and the form elements are auto-named with .asp so I can't rely on any hard-coding for that part at least. (actually the .asp code I discussed in the first post does find and list the items in the dynamic table, but there are no checkboxes in it...)

    The crux of the matter is this: the code

    <%
    For Each item In Request.Form
    Response.Write(item) & "<b r>"
    Next
    %>

    Finds and lists the NAMES of drop-downs, text boxes and submit/reset buttons but NOT checkboxes. The html code for a textbox is:

    <input type="text" name="RecipientsNumber" size="10">

    the html for a checkbox is:

    <input type="checkbox" name="Private_Attendance" value="ON">Private Organization


    Why my little asp loop skips the checkbox input type is the mystery. I'm thinking there's some kind of keyword to make asp find checkboxes.

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: auto-listing all Form elements

    DOH! Silly me! <img src=/S/bingo.gif border=0 alt=bingo width=15 height=22>

    I forgot... Checkboxes don't show up in the Request.Forms collection unless they're checked.

    You'll want to use the "CHECKED" keyword rather than Value="ON"

    <input type="checkbox" name="Private_Attendance" Checked>Private Organization

    Hope this helps

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: auto-listing all Form elements

    aha! makes sense. now i have to do a lot of clicking but c'est la vie.. or, as they say *these* days, c'est la guerre [may be mispelled there]

Posting Permissions

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