For Loop -- For Pete's Sake

Results 1 to 4 of 4

Thread: For Loop -- For Pete's Sake

  1. #1
    Petre Guest

    Default For Loop -- For Pete's Sake

    This is an abbreviated version of my code. I have a form with dynamically generated checkboxes. On the submit page, I must parse the value of the checkbox into three parts. It all works so long as checkbox one is checked, but if one is not checked then I get an error: Subscript out of range: &#039;[number: 0]&#039;<BR><BR><BR>So I wrote this, trying to say that if the first value = "", then go to the next. (I put in the response.write &#039;PASS&#039; to see what happened on the first loop. It writes &#039;Pass&#039; but does not move on to the &#039;next&#039;. How can I make this work?<BR><BR>x=1 <BR>for each item in request.querystring <BR>value=request.querystring("buy"&x) <BR>if value &#060;&#062; "" then <BR><BR>ary=split(value, "?$#") <BR>if value &#060;&#062; "" then <BR>-- my arrays -- <BR>ELSE <BR>response.write "PASS" <BR>end if <BR><BR>x=x+1 <BR>next <BR>

  2. #2
    LeeAnnie Guest

    Default RE: For Loop -- For Pete's Sake

    How about this.... On your form, have a hidden input field that is updated each time a new checkbox is created. <BR><BR>When the form is first loaded, set the hidden vaue to -1. Then, as a new checkbox is created, increase the hidden value by one. When you submit the form, you will know that no checkboxes were checked if the value is still -1. <BR><BR>&#039;this will not run if the value is -1<BR>for i = 0 to request("myHiddenValue")<BR>&#039;do work<BR>next<BR><BR>HTH<BR>

  3. #3
    Petre Guest

    Default Okay, maybe, but .... back to my code

    I will experiment with that, but I am more interested in why after my end if, the code I have does not move on the NEXT

  4. #4
    LeeAnnie Guest

    Default RE: Okay, maybe, but .... back to my code

    Hard to say.... In the example you have given, there are two if statements and only one end if. Can you update your example?

Posting Permissions

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