SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Phil fillup07's Avatar
    Join Date
    May 2002
    Location
    Jacksonville, FL
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    nevermind, got it finally

    nevermind, finally figured it out myself after several hours of playing around... and moving to vbscript
    Last edited by fillup07; Jan 1, 2004 at 23:18.

  2. #2
    SitePoint Evangelist Mr. Brownstone's Avatar
    Join Date
    May 2002
    Location
    Relative
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The answer to your problem is easier than you think. Although I am currently in a position where I canít copy-and-paste code, I can at least point you in the right direction.

    The problem of handling a variable number of check-boxes can be solved using a single hidden-field. Take the following code for example:
    Code:
    <input type="checkbox" name="select1" value="10" />
       <input type="checkbox" name="select2" value="23" />
       . . .
     <input type="checkbox" name="select3" value="17" />
    This form would have been generated in your ASP page using some kind of loop. You then need some information to pass on to the submit-page giving a clue as to exactly how many check-boxes should be analysed for their value. In your loop, you simply build-up a comma-delimited list of all the names of your check-boxes, so that you end up with something like this:
    Code:
    <input type="hidden" name="checkNames" value="select1,select2, ... select10" />
    The form that you submit to would then be able to decipher from this exactly what was and was not checked. The pseudo-code would look something like this:
    Code:
    sCheckNames = Response.Form ( 'checkNames' );
       sCheckNames = sCheckNames.split ( ',' ); // Split the comma-delimited string into an 
     				array so that we can access the values through an index
       
       for ( all items in sCheckNames ) {
       	sCheckName = sCheckNames [ currentItem ];
     	sCheckValue = Response.Form ( sCheckName );
       	// Process the value
       	// . . .
       }
    I hope this helps.

    EDIT - Mistake in pseudo-code.
    Of course, that's just my opinion. I could be wrong.


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
  •