Skip to forum content

Mif

— mystic javascript interface

You are not logged in. Please login or register.


Post new reply

Post new reply

Compose and post your new reply

You may use: BBCode Images Smilies

All fields labelled (Required) must be completed before the form is submitted.

Required information for guests



Captcha image. Turn pictures on to see it.
Required information
Optional post settings

Topic review (newest first)

1

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!!!

2

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 wink

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.

3

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

4

Thanks moro

5

new Request({
    url: 'check_process.php',
    method: 'post',//or get
    onComplete: function(answer){
        //do something
    }
}).send({data:{checked:yourTree.getChecked()}})

6

- Did you try what return print_r($_POST) after submiting form field?

7

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