This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi all I have run into a slight issue creating one of my pages. I am trying to make a page that allows users to work their way through multiple levels in a tree structure. I have managed to get the code to almost work. The only issue being that I lose the value of the references that were made before the current one. To explain: My tree can go to a possible 7 levels deep. Each level has 5 choices. The first level is always displayed on the screen (it's placed there when the form is created. The next level values will be determined based on which of the first level values is selected. When this happens I want show the first level as well as all the results that are below the choice from the first level. Then when the choose one from the second level I want to add on the third level values that are below the second level value that was selected.
My big issue is I haven't figured out a way to keep each of the variables around once they have been choosen. The only thing that I can think of is to throw them into session. Is there any other thoughts or manners in which to accomplish this ?
thanks in advance.
Sorry if this is run-on. Not sure how else to describe it.
When the user selects a level are you submitting a form? If so then probably the easiest way to keep the values is to store them in hidden fields using the html:hidden tag. They way all the parent values will be submitted along with the current selection.
Joined: Aug 23, 2006
Originally posted by Brent Sterling: When the user selects a level are you submitting a form? If so then probably the easiest way to keep the values is to store them in hidden fields using the html:hidden tag. They way all the parent values will be submitted along with the current selection.
I had thought about that, but for some reason I thought the hidden fields would be cleaned up everytime.
thanks for the suggestion.
Joined: Feb 08, 2006
A hidden field works pretty much just like a text field...well except it is hidden so the user cannot edit the value. When the page is loaded the hidden fields are populated with the values from your form and when the page is submitted the values of the hidden fields are submitted as well. During development you can try using html:text field to make it easier to see the values.