[Javascript] Need Checkbox help.

Quale, Michael QualeM at americanimaging.net
Tue Aug 21 15:29:26 CDT 2001


Thank you all, especially you Peter.
I getting closer but not quite there.
I am now getting an error stating that I'm missing (;)?

Oh well, it will have to wait because I'm leaving for an overdue vacation
right now.

Peter, I must apologize to you though.
A while back I was short with you when trying
to seek help and I didn't like your response.

I save many of the best solutions from these lists
and when looking through my collection your name is there
quite often.

I want to thank you!

You are a gentlemen and a scholar!

Good day to you all!

Mike Q.

Michael Quale
Web Developer
American Imaging Management, Inc.

[E] Web_Master at americanimaging.net
[P] 847.559.6523
[F] 847.559.6900
 

-----Original Message-----
From: Peter Brunone [mailto:peter at brunone.com]
Sent: Tuesday, August 21, 2001 2:59 PM
To: javascript at LaTech.edu
Subject: Re: [Javascript] Need Checkbox help.


Oh... *duh*... I just realized what I should have seen five posts ago.

    You're passing an undefined variable -- the value generated by
<%=rsDisplayAll("parent_id")%> -- into the function.  The only reason the
function doesn't balk is that the value is an integer.
    To make this work, you need to build the object reference to the parent
checkbox using the eval() function, like this:

function selectParent(cBox,pBox)
{
    if(cBox.checked == true) {
        var parentBox = eval("document.precert_request_form5." + pBox);
        parentBox.checked = true;
        }
    }

    I would also recommend appending a non-numeric character to the IDs as
part of the name so that the JS engine doesn't get confused and think that
you want to work with integer values, but that's up to you.

Cheers,

Peter

----- Original Message -----
From: "Quale, Michael" <QualeM at americanimaging.net>
To: <javascript at LaTech.edu>
Sent: Tuesday, August 21, 2001 2:19 PM
Subject: RE: [Javascript] Need Checkbox help.


| OK Here goes:
|
| As for the checkboxes being named the same, I do not see this as a problem
| because I'm using a unique item_id for each box.
|
| Here is an example of what I get:
|
| Parent:
|
| <input type=checkbox id="118" name="118" value="118">
|
| Child:
|
| <input type=checkbox id="119" name="119" value="119" LANGUAGE=javascript
| onclick="selectParent(this,118)">
|
| Do you think this could be a character problem?
|
| Numeric vs Char?
|
| Thanks for your help.
|
| Mike Q.
|
|
| -----Original Message-----
| From: Peter Brunone [mailto:peter at brunone.com]
| Sent: Tuesday, August 21, 2001 2:19 PM
| To: javascript at LaTech.edu
| Subject: Re: [Javascript] Need Checkbox help.
|
|
| Michael,
|
|     It would be helpful to see the output, i.e. what the ASP code is
| generating as the name of the checkbox.  This could very well be your
| problem.
|     Additionally, you might have more than one checkbox of the same name;
| this would create a similar problem.
|
| -Peter
|
| ----- Original Message -----
| From: "Quale, Michael" <QualeM at americanimaging.net>
| To: <javascript at LaTech.edu>
| Sent: Tuesday, August 21, 2001 1:35 PM
| Subject: [Javascript] Need Checkbox help.
|
|
| | I'm creating a dynamic list of check boxes based on the form selected.
| |
| | I have parent checkboxes which can have multiple child checkboxes.
| |
| | If a user selects a child I need to (onchange) check the parent
checkbox.
| |
| | I'm tried many combinations of the code below but keep getting
| | "document.precert_request_form5.pBox not an object" errors.
| |
| | **********
| | <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
| | <!--
| | function selectParent(cBox,pBox)
| | {
| | if(cBox.checked == true) {
| | document.precert_request_form5.pBox.checked = true;
| | }
| | }
| |
| | //-->
| | </SCRIPT>
| | *********
| |
| | 'Dynamically built parent checkbox
| | <input type=checkbox id="<%=rs("item_id")%>" name="<%=rs("item_id")%>"
| | value="<%=rs("item_id")%>">
| |
| | 'Dynamically built child checkbox
| | <input type=checkbox id="<%=rs("item_id")%>" name="<%=rs("item_id")%>"
| | value="<%=rs("item_id")%>" LANGUAGE=javascript
| | onclick="selectParent(this,<%=rsDisplayAll("parent_id")%>)">
| |
| | Any help is good help!
| |
| | Thanks,
| |
| | Mike Q.
|
| _______________________________________________
| Javascript mailing list
| Javascript at LaTech.edu
| http://www.LaTech.edu/mailman/listinfo/javascript
| _______________________________________________
| Javascript mailing list
| Javascript at LaTech.edu
| http://www.LaTech.edu/mailman/listinfo/javascript
|

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list