[Javascript] Need Checkbox help.

Mark Christie MChristie at avsgroup.com
Tue Aug 21 14:12:16 CDT 2001


Well, my recent experiences have been different...Perhaps that wasn't the
real problem after all, but renaming the element ids did solve the problem
for me...

Regards,
   -Mark C.


-----Original Message-----
From: Esther_Strom at hmco.com [mailto:Esther_Strom at hmco.com]
Sent: Tuesday, August 21, 2001 2:07 PM
To: javascript at LaTech.edu
Subject: RE: [Javascript] Need Checkbox help.



I've used underscores in field and variable names frequently with no
problem. There's nothing in the specification that states you can't use
them.



 

                    Mark Christie

                    <MChristie at avsgro        To:
"'javascript at LaTech.edu'" <javascript at LaTech.edu>                 
                    up.com>                  cc:

                    Sent by:                 Subject:     RE: [Javascript]
Need Checkbox help.                         
                    javascript-admin@

                    LaTech.edu

 

 

                    08/21/01 02:02 PM

                    Please respond to

                    javascript

 

 





I've noticed that the DOM doesn't like elements that have underscores (_)
in
them...Try renaming your elements to something like precert5 or
precertrequestform5 and see if that does the trick...

Since your checkboxes are dynamically built, you may need to do something
like this:
<input type=checkbox id="<%=Replace(rs("item_id"), "_", "")%>"
name="<%=Replace(rs("item_id"), "_", "")%>"
value="<%=Replace(rs("item_id"), "_", "")%>">

or this:

<input type=checkbox id="<%=stripUnderscore(rs("item_id"))%>"
name="<%=stripUnderscore(rs("item_id"))%>"
value="<%=stripUnderscore(rs("item_id"))%>">

<%
function stripUnderscore(str) {
   stripUnderscore = Replace(str, "_", "");
end function
%>

[CAVEAT: UNTESTED]

Then your item_id of precert_request_form5 will become your element id of
precertrequestform5.

Best Regards,
  -Mark C.


-----Original Message-----
From: Quale, Michael [mailto:QualeM at americanimaging.net]
Sent: Tuesday, August 21, 2001 1:35 PM
To: 'javascript at LaTech.edu'
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