Hi Everyone,
With guidance/code from Walter and Marty, I'm finally sorted. :-) My
code had to find the tag element id and change a style on the
corresponding user labels after the onClick event. Basically, click a
tag and then all the people assigned to the tag will be highlighted and
checked. Then remove the highlight and uncheck when checked = false.
Thanks again for the help.
Jenny
<script>
document.observe('click',function(evt){
if(evt.element().hasClassName('tag')){
var status = evt.element().checked;
var identity = evt.element().identify();
if(status == true) {
var checkedTags = $$('input.tag:checked');
$$('input.user').each(function(elm){
var checked = false;
checkedTags.each(function(c){
var labelId = 'labelfor' +
$(elm).identify();
if(elm.hasClassName(c.id) && status
== true) {
checked = true;
$(labelId).addClassName('sel');
}
});
elm.checked = checked;
});
}
else {
var uncheckedTags = identity;
$$('input.user').each(function(elm){
var checked = true;
var labelId = 'labelfor' +
$(elm).identify();
if(elm.hasClassName(uncheckedTags) &&
status == false) {
checked = false;
$(labelId).removeClassName('sel');
}
elm.checked = checked;
});
}
}
if(evt.element().hasClassName('user')){
$$('input.tag').each(function(elm){
elm.checked = ($$('input.' + elm.id).length
== $$('input.' + elm.id + ':checked').length);
});
}
});
</script>
On 21/03/2012 5:54, Walter Lee Davis wrote:
Happy to help!
Walter
On Mar 21, 2012, at 1:31 PM, Jennifer Mostert wrote:
Hi Walter,
Thank you so much. This is fantastic.
Really appreciate the help.
Jenny
On 19/03/2012 4:09, Walter Lee Davis wrote:
Here's a slight detour from your code. Instead of the hash with the groups,
they are added in the HTML as classnames.
http://jsbin.com/inusaz
Walter
On Mar 16, 2012, at 5:43 AM, Jenny76 wrote:
I need a Prototype script to do exactly what this one does. Anyone
interested in walking me through what changes need to be made to turn
it into Prototype? I tried on my own yesterday, and need some
guidance.
http://jsfiddle.net/8wBg7/31/
Thanks in advance,
Jenny
--
You received this message because you are subscribed to the Google Groups
"Prototype& script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Prototype& script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.
--
You received this message because you are subscribed to the Google Groups "Prototype
& script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.