Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting, accessing dynamic textfield values

Posted on 2004-07-30
3
Medium Priority
?
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

688 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