PDA

View Full Version : Sending multiple tree node values to server.



rahulmca1@gmail.com
9 Jan 2007, 5:47 AM
Hello Friends,


I have to provide user with the option of selecting tree nodes(one or more) and then submit the selected nodes to server. What I want to ask is that can we have checkbox(or any other way) as tree nodes so that user can check those nodes whose values are to be send to server for processing.
Till now I am using YAHOO.widget.TextNode.


waiting for your response

Thanks
with regards

rahulmca1@gmail.com
9 Jan 2007, 9:43 PM
Well I found YAHOO.widget.HTMLNode and using it I can have tree with the html node I specify for eg say checkbox. But how get the input from them.

var html ='<input type="checkbox" id="Publication"'+i+'value="Picture"> Publication';
var tmpNode = new YAHOO.widget.HTMLNode(html, tree.getRoot(), false,false);

I tried to use

var check = document.getElementById("Publication");
alert("check="+check);

But it is returning me null. :?: :?:
Iwanted to get that value so that I could check if it is selected or not.

Is therre a way to get <input type="checkbox" id="Publication"'+i+'value="Picture"> Publication
elment.



It would be nice if you can give me examples or demo.


Thanks in advance :) :)

Animal
10 Jan 2007, 12:22 AM
Well I found YAHOO.widget.HTMLNode and using it I can have tree with the html node I specify for eg say checkbox. But how get the input from them.

var html ='<input type="checkbox" id="Publication"'+i+'value="Picture"> Publication';
var tmpNode = new YAHOO.widget.HTMLNode(html, tree.getRoot(), false,false);

I tried to use

var check = document.getElementById("Publication");
alert("check="+check);

But it is returning me null. :?: :?:
Iwanted to get that value so that I could check if it is selected or not.

Is therre a way to get <input type="checkbox" id="Publication"'+i+'value="Picture"> Publication
elment.



It would be nice if you can give me examples or demo.


Thanks in advance :) :)

What?

Run your app in Firefox with the Firebug addon enabled.

Break at the line which generates the HTML. Look at the string created. Then when the tree node is created, right click on it, and select "Inspect Element" to see the DOM nodes created as a result. What is the ID of the input element created?

You can then switch to the Console view, and type in those two test lines, and see what you get.

You code hints at you wanting to generate unique IDs for your checkboxes by adding a rolling number onto the end of the string "Publication" although your code doesn't in fact do that because it's buggy, and you haven't tested it properly.