Displaying form x number of times

Results 1 to 5 of 5

Thread: Displaying form x number of times

  1. #1
    Eric Kaiser Guest

    Default Displaying form x number of times

    I have a two part form for inputting data into a database. The first form gathers basic product information and asks the user for a number of "size options". I want to use that number to set the number of times the size option form is displayed to them. (I hope that makes sense) For example, if the user puts in 3, they will need to fill in the size option form 3 times. (the size option form has fields for quantity ranges and prices which can be extensive).<BR><BR>Part of the problem is I don&#039;t know what I am searching for here. I know I need to create some kind of counter that will display the form x number of times, but I don&#039;t have any idea how to go about doing that. If anybody has a tutorial or some other info on what I&#039;m trying to do, please let me know!<BR><BR>Thanks in advance for your help.

  2. #2
    rwadkins@tsccg.com Guest

    Default RE: Displaying form x number of times

    It sounds, if I&#039;m understanding you correctly, like you need a for...next loop. Let&#039;s say that your field for number of sizes is "NumSizes":<BR><BR>&#060;%<BR> For x = 1 to request.form("NumSizes")<BR> ... Code to write the instance of the form ...<BR> Next<BR>%&#062;<BR><BR>However, you should have the entire thing as part of one form, and possibly append &#039;x&#039; to the end of each field&#039;s name so you can step through them in a controlled fashion. If you call every element of each size section the same, you&#039;ll end up with a bunch of arrays that may or may not be hard to work with.

  3. #3
    Eric Kaiser Guest

    Default RE: Displaying form x number of times

    Thank you, that&#039;s what I&#039;m trying to do.

  4. #4
    the other steve Guest

    Default RE: Displaying form x number of times

    I&#039;ve had a similar problem with the &#039;details&#039; section of my database where each &#039;parent&#039; has unlimited numbers of details. i&#039;m using a subtable of &#039;details&#039; each with its own id and linked to the parent with a many-to-one relationship.<BR><BR>Adding to the previous answers, something like:<BR><BR>for x = 1 to rownumber<BR>response.write "&#060;input name=""variable" & x & """&#062;<BR>"<BR>next<BR><BR>So if you have 4 rows, you&#039;ll get four textboxes with four variables named variable1, variable2, variable3, variable4.<BR><BR>You then need to add these to your database. I don&#039;t know your project, but you should probably be using a subtable with a many (subtable) to one (maintable) relationship. Each input should go in its own row in the subtable.<BR><BR>As you were.

  5. #5
    rwadkins@tsccg.com Guest

    Default RE: Displaying form x number of times

    However, Microsoft does such a good job with subtables that most people want that kind of functionality in an ASP solution. But it&#039;s not really the smartest way to do that. When I&#039;ve needed to work with subtables, I&#039;ve created a separate page to edit and add subtable information and on the main page listed existing entries with an edit link and created an add link. Not as fast as an Access type subtable...but, by and large, easier to manage.

Posting Permissions

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