Topic: Getting Checked nodes from post?
Hi,
I was wondering if it is at all possible to receive all checked nodes in a form POST?
How would that work? Or how else can I get all checked nodes back to a server side php file?
Thanks
Adriaan
You are not logged in. Please login or register.
Pages 1
Hi,
I was wondering if it is at all possible to receive all checked nodes in a form POST?
How would that work? Or how else can I get all checked nodes back to a server side php file?
Thanks
Adriaan
- Did you try what return print_r($_POST) after submiting form field?
new Request({
url: 'check_process.php',
method: 'post',//or get
onComplete: function(answer){
//do something
}
}).send({data:{checked:yourTree.getChecked()}})Hi Moro,
I tried your suggestion like this:
function getChecked() {
console.log(tree.getChecked());
}But firebug reports the following error:
too much recursion
[Break on this error] var msg = "Error in hook: "+ exc +" fn=\n"+fn+"\n stack=\n";Please I need a solution really urgently...so any help would be greatly appreciated
Moro,
I also tried using a hidden input field, and add the node id's to that input field as soon as they are checked, and remove them again as they are unchecked, which should work fine, but...there's always a but ![]()
The dependant nodes do not fire events when they are indirectly checked, how could I fire events for them, because then I wouldn't need a solution to the problem I posted above...
Thanks again for your help, I really appreciate it.
Hi Moro,
I found a solution to fire the event when dependant checkboxes are checked and unchecked:
I changed this code:
var setState=function(node, state){
if(!node.hasCheckbox) return;
var oldState=node.state.checked;
node.state.checked=state;
if(!node.parentNode || (node.parentNode && node.parentNode.$draw)){
node.getDOM('checkbox').removeClass('mif-tree-node-'+oldState).addClass('mif-tree-node-'+state);
}
};To this:
var setState=function(node, state){
if(!node.hasCheckbox) return;
var oldState=node.state.checked;
this.tree.fireEvent(checked=='checked' ? 'check' : 'unCheck', node);
node.state.checked=state;
if(!node.parentNode || (node.parentNode && node.parentNode.$draw)){
node.getDOM('checkbox').removeClass('mif-tree-node-'+oldState).addClass('mif-tree-node-'+state);
}
};Thanks for a great class!!!
Posts [ 7 ]
Pages 1
Powered by PunBB