Posting a value back to a form field without reloading the page

J

Jacob

I have a page Add_data.asp which accepts a number of user-entered variables
and then inserts them into a database. I have another page, Loc_tree.asp
which when accessed, returns a tree of locations which is dynamically
generated by the server. The Loc_tree.asp creates a hyperlink for each
object in the tree. I need to show the Location Tree in a separate window,
and then when a location is clicked, I need to have some javascript code in
the hyperlink which will post a particular value back to the form and insert
it into the appropriate field. The field is a little ways down the form, so
linking to the form from the Loc_tree.asp with some type of GET (i.e.
add_data.asp?LocID=2) is not acceptible. There must be some way of loading
a seperate window (I'm thinking IFRAME), allowing the user to select a value
in it, then inserting the value into the appropriate field and rehiding the
location tree.

Any help would be greatly appreciated.

Jacob
 
S

spaghetti

Jacob said:
I have a page Add_data.asp which accepts a number of user-entered variables
and then inserts them into a database. I have another page, Loc_tree.asp
which when accessed, returns a tree of locations which is dynamically
generated by the server.

Here's what I would do:

Remake the tree so it's actually a list of checkboxes/radio buttons and put
it inside the add_data.asp page. Put all the checkboxes in a standard list,
and use the Expandable Menu technique from
http://www.gazingus.org/html/menuExpandable.html to make it tree-like.

This will make a nice expandable-tree menu that doesn't require iframes or
Javascript, and does exactly what I think you're looking for.
 
J

Jacob

Unfortunately, the setup which you have suggested doesnt account for the
fact that all my data is dynamic and in a random order in the table. Any
other ideas?

Jacob
 
S

spaghetti

Jacob said:
Unfortunately, the setup which you have suggested doesnt account for the
fact that all my data is dynamic and in a random order in the table. Any
other ideas?

Okay, do you mean the data for the tree is client-side dynamic (values are
loaded with Javascript) or server-side dynamic (ASP generates all the code
for the tree)? Or are you saying that the whole page is random, not just the
tree?
 
J

Jacob

The data is server-side dynamic out of a table. The setup I have correctly
processes the records even though they are in a random order coming out of
the database. However, the method you described requires that the records
be in a specific order, so the lists are built as the children of the wrong
parent lists. I'm already using IFRAMEs elsewhere in the site to do
something along the lines of what I want to do in this case, but I am having
an immense amount of problems porting the code over to the new page. I know
very little about JavaScript and the other code I'm using I was able to find
prepackaged. I just have to make a few modifications.

Thanks,
Jacob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top