Solved

Getting, accessing dynamic textfield values

Posted on 2004-07-30
3
190 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:Squinky
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

757 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