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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passinga a value to a drop down box?

Status
Not open for further replies.

johan456

Technical User
Oct 27, 2005
2
ZA
Hi there! I have an Display page that shows data from a database, that same page has an option to edit the displayed information. When I go to the Edit page, several fields have drop down boxes to limit the choices the user can select from.

Here's my problem: Say I have a field in the Display page that lists the city a company is located in. When I go to the Edit page, the city field is represented by a drop-down box so the user can only select certain cities. However, whatever value was shown in the Display page is now lost. The drop down box always is always blank forcing the user to select the city again. That's fine if you wanted to edit the city, but if I have Tampa selected as the city, and Ford as the company and I want to change Ford to GM I lose Tampa when I go to the Edit page.

My question is this: How can I pass a value from one page into a drop down box on another page? The drop down box is being populated from a database, but the field always starts blank. I want to pass a value into that blank field. Can this be done?
 
Set a if statement on your drop down that looks to see if there is a value in the box. If not show the blank, if so then retain the value.
 
Thanks, but what coding would you use to retain that value?
 
Start with this

<script Language=&quot;VBScript&quot;><!--
Sub comboboxname_Onclick
Set theForm = document.FrontPage_Form2 'Your form name
theForm.comboboxname.????? 'not sure what goes here
End sub
--></script> DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top