wicked
Junior Member
Posts: 6
Registered: 6/23/2005
Location: boston
Member Is Offline
|
| posted on 6/23/2005 at 11:41 PM |
|
|
Target CheckBoxes with selections on tree
Is there a way to set up the target to be a checkbox in a form. I have a checkbox form next to the tree...I'm trying to set it up so when a user
selects something on the tree it checks off a corosponding checkbox on my form any ideas?
|
|
|
rock
Moderator
Posts: 687
Registered: 4/15/2003
Member Is Offline
|
| posted on 6/24/2005 at 10:28 AM |
|
|
Use javascript as item's link. E.g.:
['item (un)checks checkbox', 'javascript:my_function_for_ckecking("checkbox_id")']
|
|
|
wicked
Junior Member
Posts: 6
Registered: 6/23/2005
Location: boston
Member Is Offline
|
| posted on 6/24/2005 at 06:19 PM |
|
|
Great!! thanks for the help...by the way you wouldn't happen to know of any java script funtions I could use for the call
IE. 'javascript:my_function_for_ckecking
Kind of a newbie at this would greatly appreciate all the help i could get.
thanks again.
|
|
|
rock
Moderator
Posts: 687
Registered: 4/15/2003
Member Is Offline
|
| posted on 6/24/2005 at 07:47 PM |
|
|
Try something like
function my_function_for_ckecking (s_checkbx_name) {
var o_form = document.forms['my_form_name'];
var o_cbx = o_form.elements[s_checkbx_name];
if(o_cbx) o_cbx.checked = !o_cbx.checked; //toggle
}
|
|
|
wicked
Junior Member
Posts: 6
Registered: 6/23/2005
Location: boston
Member Is Offline
|
| posted on 6/24/2005 at 08:30 PM |
|
|
Hmm still not working out so good here is the code in place:
In the tree_items.js config file:
var TREE_ITEMS = [
['My Worklists', null,
['item (un)checks checkbox',
'javascript:my_function_for_ckecking("Q1-1_chk4")']
]
The form in the main page:
<script language="JavaScript">
<!--
function my_function_for_ckecking(s_checkbx_name)
{var o_form = document.forms['form_1'];
var o_cbx = o_form.elements[s_checkbx_name];
if(o_cbx) o_cbx.checked = !o_cbx.checked; //toggle
}
//-->
</script>
<form name="form_1" method="post" action="">
<input name="Q1-1_chk4" type="checkbox" id="Q1-1_chk4" value="test">
test
</form>
It's actually opening another window when i click the link.
Thank you so much the way I appreciate all the help you are giving in advance
|
|
|
rock
Moderator
Posts: 687
Registered: 4/15/2003
Member Is Offline
|
| posted on 6/25/2005 at 07:09 PM |
|
|
The correct syntax is:
var TREE_ITEMS = [
['My Worklists', null,
['item (un)checks checkbox', "javascript:my_function_for_ckecking('Q1-1_chk4')"]
]
]
Also check target setting (tree_tpl.js):
var TREE_TPL = {
'target' : '_self', // name of the frame links will be opened in
...
}
|
|
|
wicked
Junior Member
Posts: 6
Registered: 6/23/2005
Location: boston
Member Is Offline
|
| posted on 6/25/2005 at 07:20 PM |
|
|
Ok Thanks for the info....one last Q should I keep this function:
<script language="JavaScript">
<!--
function my_function_for_ckecking(s_checkbx_name)
{var o_form = document.forms['form_1'];
var o_cbx = o_form.elements[s_checkbx_name];
if(o_cbx) o_cbx.checked = !o_cbx.checked; //toggle
}
//-->
</script>
In the head of the main page or does this need to go into the tree.js file?
|
|
|
wicked
Junior Member
Posts: 6
Registered: 6/23/2005
Location: boston
Member Is Offline
|
| posted on 6/25/2005 at 07:33 PM |
|
|
AWSOME!!!!!!!!!!!!!!
MAN, You ROCK HARDCORE!!!....I just got it to work and I'm absolutely psyched!!! Thanks for sticking with me...You will never know how much I
appreciate this help
Outstanding work ;)
|
|
|
wicked
Junior Member
Posts: 6
Registered: 6/23/2005
Location: boston
Member Is Offline
|
| posted on 6/25/2005 at 09:29 PM |
|
|
One more time please
ok ok ok one last question since I know your good at this....
I've got a pretty large form of checkboxes somewhere in the 3-400 range clicking the link will check the box but the user has no idea the box has
been checked really unless they scroll down. The checkboxes are arranged in categories mimicking the tree. Either I'd like to set up anchors at
each checkbox section so after they click the link in the tree it brings them to the spot where the checkbox is. than they could just click a simple
#top link to get back up to the tree (that part I can do). But can I add this into the existing function something like:
<script language="JavaScript">
<!--
function my_function_for_ckecking(s_checkbx_name,anchor)
{var o_form = document.forms['form_1'];
var o_cbx = o_form.elements[s_checkbx_name];
if(o_cbx) o_cbx.checked = !o_cbx.checked; //toggle
onclick=document.location=[anchor]; <--- just a guess
}
//-->
</script>
Does that make sense?
|
|
|