Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Dynamically Name a Checkbox

Reply
Thread Tools

Re: Dynamically Name a Checkbox

 
 
birdmant
Guest
Posts: n/a
 
      08-19-2004

Jeff Thies wrote:
> *birdmant wrote:
> > I am running a query to return product codes and would like t

> creata a
> > checkbox for each row returned. I would like to give the checkbo

> a
> > name using this code so that I can identify it. I'm moving th

> product
> > code to an array but am not successful in setting the name to th

> code
> > value. I've tried arrays and variables to no avail.
> >
> > Is there a way to do this? This is the piece of code I'm using.
> >
> > while (!rs.EOF)
> > {
> > a[x] = rs.Fields("PROD_CD");
> > Response.Write("<input type='checkbox' name=a[x] checked
> > onclick='clickbox(this)'>");
> > Response.Write("<br>");
> > rs.MoveNext();
> > x++;
> > }

>
> I'm not ASP guy but doesn't that print a[x] instead of the value. .
>
> You'll want to quote the attribute if it contains spaces and mak
> theres
> characters it can't start with like digits (I think).
>
> I would do something like this:
>
> Response.Write("<input type='checkbox' name=checkbox_'" + a[x] + "'
> checked onclick='clickbox(this)'>");
>
> Iterate through the form collection and look for fields startin
> with
> checkbox_ , and extract the field name.
>
> That may be bad ASP. I don't know how you guys can use ASP, what it
> can't do drives me crazy!
>
> PROD_CD is unique isn't it?
>
> Jeff
>
> >
> >
> > Any help would be greatly appreciated.
> >
> > Tom
> >
> >
> >
> > --
> > birdmant

>
> ------------------------------------------------------------------------
> > Posted via http://www.forum4designers.com

>
> ------------------------------------------------------------------------
> > View this thread

> http://www.forum4designers.com/message109289.html
> > *


Jeff,

Thanks for the reply. When I do this the name becomes:

checkbox_ +a[x] +

It doesn't put the value of array a[x] element.

And yes, prod_cd is unique.

To


-
birdman
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message109289.htm

 
Reply With Quote
 
 
 
 
Jeff Thies
Guest
Posts: n/a
 
      08-21-2004
birdmant wrote:
> Jeff Thies wrote:
>
>>*birdmant wrote:
>>
>>>I am running a query to return product codes and would like to

>>
>>creata a
>>
>>>checkbox for each row returned. I would like to give the checkbox

>>
>>a
>>
>>>name using this code so that I can identify it. I'm moving the

>>
>>product
>>
>>>code to an array but am not successful in setting the name to the

>>
>>code
>>
>>>value. I've tried arrays and variables to no avail.
>>>
>>>Is there a way to do this? This is the piece of code I'm using.
>>>
>>>while (!rs.EOF)
>>>{
>>>a[x] = rs.Fields("PROD_CD");
>>>Response.Write("<input type='checkbox' name=a[x] checked
>>>onclick='clickbox(this)'>");
>>>Response.Write("<br>");
>>>rs.MoveNext();
>>>x++;
>>>}

>>
>>I'm not ASP guy but doesn't that print a[x] instead of the value. .
>>
>>You'll want to quote the attribute if it contains spaces and make
>>theres
>>characters it can't start with like digits (I think).
>>
>>I would do something like this:
>>
>>Response.Write("<input type='checkbox' name=checkbox_'" + a[x] + "'
>>checked onclick='clickbox(this)'>");
>>
>>Iterate through the form collection and look for fields starting
>>with
>>checkbox_ , and extract the field name.
>>
>>That may be bad ASP. I don't know how you guys can use ASP, what it
>>can't do drives me crazy!
>>
>>PROD_CD is unique isn't it?
>>
>>Jeff
>>
>>
>>>
>>>Any help would be greatly appreciated.
>>>
>>>Tom
>>>
>>>
>>>
>>>--
>>>birdmant
>>>

>>
>>------------------------------------------------------------------------
>>
>>>Posted via http://www.forum4designers.com
>>>

>>
>>------------------------------------------------------------------------
>>
>>>View this thread:

>>
>>http://www.forum4designers.com/message109289.html
>>
>>>*

>
>
> Jeff,
>
> Thanks for the reply. When I do this the name becomes:
>
> checkbox_ +a[x] +


Change my +'s to &'s. Didn't I mention I'm not an ASP guy?

This is basic ASP stuff. Take a look at an ASP FAQ like:

<URL: http://www.aspfaqs.com/aspfaqs/ >

Also, stop using the Designers Forum. Find out how to set up usenet on
your mail client. Microsoft has a free usenet server:
news.microsoft.com. Set that up and ask in a MS ASP group. And then read
the posting guidelines or read other posts to see how this is done.

Usenet is a wonderfull thing and is much better when you access it
correctly! You'll be telling/showing others this in a few months.

Jeff


>
> It doesn't put the value of array a[x] element.
>
> And yes, prod_cd is unique.
>
> Tom
>
>
>
> --
> birdmant
> ------------------------------------------------------------------------
> Posted via http://www.forum4designers.com
> ------------------------------------------------------------------------
> View this thread: http://www.forum4designers.com/message109289.html
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check all the checkboxes if checkbox name is 'name[]' PhpCool Javascript 9 10-30-2008 03:36 AM
disable checkbox list checkbox Vikram ASP .Net 1 01-25-2006 02:59 PM
Text on Checkbox below the checkbox tshad ASP .Net 0 04-14-2005 11:26 PM
Getting dynamically web app name [or virtual dir name] =?Utf-8?B?TWljaGHFgiBKYW51c3pjenlr?= ASP .Net 1 08-30-2004 01:48 AM
Dynamically Name a Checkbox birdmant HTML 1 08-18-2004 04:54 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57