Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Getting, accessing dynamic textfield values

Posted on 2004-07-30
3
Medium Priority
?
249 Views
Last Modified: 2006-11-17
Hi
I am working in PHP.I have tree view which is made with database. The database for this tree has a PARENT CHILD relation based in id. I have to give the user an option of adding new nodes at different tree levels. For that i am using textfields in the tree where ever the insertion of new node is possible. The question is that how can i come to know that which text field has which parent so that i can save its value, which will ba string, against its parent id....

ne suggestion, comment....

Regards

0
Comment
Question by:zsadal
  • 2
3 Comments
 
LVL 25

Expert Comment

by:Marcus Bointon
ID: 11675134
Well, either you or the user needs to specify where this new item will be attached - you can't just figure it out by magic. Perhaps a pop-up that lists all nodes so that they can select what it is attached to?
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 375 total points
ID: 11676750
My choice would be that if they want to modify the tree, each element on the tree has a button (or a series of buttons).

[+] Add Node
[-] Remove Node (only if end of tree)
[--] Remove Node and all sub nodes
[Up] Move the node above the previous node at the same level
[Down] Move the node below the next node at the same level
[Left] Move the node up 1 level.
[Right] Move the node down 1 level as a child of the node above.
[Edit] Alter this nodes properties.

That sort of thing.

Now, admittedly, this may look a little messy.

But each button's url would be something like ...

/amendtree.php?id=ThisNodesID&parentid=ThisNodesParentID


So, as part of the rendering you can create the urls for the images on the fly as you render the node iteself.

Are you using a proper tree class? One which says find this node or find path to this node,etc.

If so, I'd like to see it. I have a tree class which allows out of sequence addition. This means I can read data which is in the format of

nodeid, parentid, data

and then add it to the tree.

The tree sorts out the heirarchy at render time.

I don't have to add the data into the tree top down.

It also means that I only need to make 1 call to the database to retrieve all the nodes.

Richard.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 11781659
I'd very much like to see this working? Especially if you create a generic class or need any further help.

My ICQ : 1711757

Regards and thanks.
Richard.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question