Solved

Getting, accessing dynamic textfield values

Posted on 2004-07-30
3
199 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:
RQuadling earned 125 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:RQuadling
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

948 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now