• auto-listing all Form elements

    Author
    Topic
    #384931

    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) & "
    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

    Viewing 0 reply threads
    Author
    Replies
    • #662138

      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.

      • #662142

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

        Private Organization

        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) & "
        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:

        the html for a checkbox is:

        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.

        • #662144

          DOH! Silly me! bingo

          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”

          Private Organization

          Hope this helps

          • #662145

            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]

    Viewing 0 reply threads
    Reply To: auto-listing all Form elements

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: