Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing data and keeping old data

Status
Not open for further replies.

dpk136

MIS
Jan 15, 2004
335
US
I have a form where there are textboxes and a bunch of dropdowns. I need to make the dropdowns repopulate with data when another is selected. This is all coming from a SQL Server database.

What i mean is, when a Part is selected in a dropdown, the data in the PO dropdown needs to be updated to match the PO's that are available for that part and so on.

The problem is, how do you do this without losing any data that has been entered?

David Kuhn
------------------
 
please check the FAQ section on this forum and you will find 3 submissions...

-DNG
 
You can use AJAX to request updated information from the database and repopulate the box with Javascript without ever submitting the form and therefore not losing the data that has been entered.

AJAX will execute the specified page and return the results of that page to the calling function. This all occurs in the background without altering the current page.


At my age I still learn something new every day, but I forget two others.
 
please check the FAQ section on this forum and you will find 3 submissions...

What did you search under?

You can use AJAX ...
How would i go about doing this? any clue?

Thanks for the fast responses.

David Kuhn
------------------
 
I misread your post originally and while AJAX is still a potential solution it is not what I think you need.

There are several ways to do this.
One method is to download all of the information from the database into one or more javascript arrays and upon selection in one box trigger the re-population of the other boxes accordingly from information stored in the array(s).

Another method is to have the form page submit to itself and at the top of the page you read in all posted form field values to insert back into the page so all data is persisted and as the page loads you populate the select boxes according to previous selections.

Another method is when a selection is made in one box you call a Javascript function that uses AJAX to retrieve additional information from the database and then populate the appropriate select box with the new data.

If the total possible amount of information for the select boxes is not huge then using javascript arrays to store the data is probably the best way to go.

There is a FAQ on Dynamic List Boxes that has examples on how to do this.
Look at this FAQ faq333-3656.



At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top