Dynamic Checkbox Names

Results 1 to 4 of 4

Thread: Dynamic Checkbox Names

  1. #1
    Join Date
    Dec 1969

    Default Dynamic Checkbox Names

    I have an ASP application which accesses an Oracle database via SQL. The query returns a number of rows. I want to display each row with a check box next to it so that the user can check one or more rows to be deleted.<BR><BR>I display the rows as follows:<BR><BR>&#060;% while not RS.EOF %&#062;<BR>-TR-<BR>-TD-<BR>-INPUT type="checkbox" name=-%box2%- id="check_box" value="cbvalue "-<BR>-/TD-<BR>-TD-<BR>&#060;%= RS("cd_tabledetail") %-<BR>-/TD-<BR>-/TR-<BR>-% RS.MoveNext<BR>WEND %-<BR><BR>(which obviously does not work).<BR><BR>I need to change the check box name for each row so that it can be passed on to the next script to actually executed the delete operation.<BR><BR>with this script I get a &#039type mismatch&#039 error. What is the best way to do this? Help would be appreciated.<BR><BR>Thanks<BR>

  2. #2
    Panos Barbalias Guest

    Default RE: Dynamic Checkbox Names

    Do this:<BR>&#060;INPUT type="checkbox" name="&#060;%=box2%&#062;" id="check_box" value="cbvalue "&#062;<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Dynamic Checkbox Names

    Hi<BR>if you code like<BR>&#060;INPUT type="checkbox" name="&#060;%=box2%&#062;" value="cbvalue"&#062;<BR>inside the while loop it should work. the name of your checkbox will vary as per the content of the variable box2.<BR><BR>hope it works<BR><BR><BR>

  4. #4
    Javier S. Guest

    Default RE: Dynamic Checkbox Names

    I see that you forgot to put the "=" in the &lt;%box2&gt;, It should be &lt;%=box2%&gt;. <BR>Besides you should avoid using the value clause with the checkbox input.<BR>Try without using it.<BR>Is box2 a numeric variable. If it is so try also using cstr(box2)

Posting Permissions

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