|
| |
|
|
JeroenDortmans
Posts: 66 From: Eindhoven Netherlands Status: offline
|
Update drop down list contents - 12/2/2001 19:05:02
Hello, I have a form with a drop down list which retrieves information from a database and displays it. I want to make it possible to update the information displayed by this drop down list. So, this drop down menu must display information from a record in table “A”, when you click on the “button” of the drop down list it must display other options which are retrieved from table “B” in the database. After that I can run an update query to update the record in the database.
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Update drop down list contents - 12/2/2001 23:34:44
I think you want to pass the result of one drop down box to query another page? If so, submit this page to page 2. On page 2, youll have a DRW which queries : Select * from table where ID = ::SelectNameInput:: "SelectNameInput" is the name of the form element from the previous page. The value of this SHOULD be the unique ID or similar. §þððk¥ Database / DRW Q & A VP-ASP Shopping cart
|
|
|
|
JeroenDortmans
Posts: 66 From: Eindhoven Netherlands Status: offline
|
RE: Update drop down list contents - 12/3/2001 2:32:46
Hi spooky, That is not what I meant. I made a form where I use a field which can have 3 results. Therefore, I made a drop down box which retrieves the information from the database. Then only one of the 3 field options is displayed in the drop down box. Now I want to be able to update the information of this field on the same page. I can do this by adding the 3 options to the drop down box. This works fine, only the option which was retrieved from the database is displayed twice. Another solution would be that the information from all the options is retrieved from another table in the same database and displayed in this drop down box. So the first solution would be fine when it will be able to have the retrieved information not displayed twice. After the information of the drop down box is modified, the user can update it in the database by clicking on a "Update" button. I do know how to do this update part, so this needs no explanation.
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Update drop down list contents - 12/3/2001 12:11:27
I guess the part Im not yet sure about is : Now I want to be able to update the information of this field on the same page. I can do this by adding the 3 options to the drop down box. §þððk¥ Database / DRW Q & A VP-ASP Shopping cart
|
|
|
|
JeroenDortmans
Posts: 66 From: Eindhoven Netherlands Status: offline
|
RE: Update drop down list contents - 12/3/2001 13:08:58
Hi spooky, I will explain. I want to be able to update the information which is in the database with the same drop down box as I used to retrieve information from the database. I managed to do this by adding 3 option to the drop down box. When you insert a drop down box and you select the properties of this drop down box you can insert values for the drop down box. But when I use it this way I get the value as it was in the database twice. I hope this will help explaining what I want.
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Update drop down list contents - 12/4/2001 15:47:56
Ahh -perhaps you want to use a "DISTINCT" SQL query? The values you see in your list box, from the query are duplicated. SELECT DISTINCT FIELD FROM TABLE §þððk¥ Database / DRW Q & A VP-ASP Shopping cart
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Update drop down list contents - 12/4/2001 16:17:04
Could be something else....Been watching this thread. I suspect what JeroenDortmans is looking for is something like: <option <%IF FP_FieldVal(fp_rs,"myFieldName") = "MenuItem1" THEN Response.Write(" selected") END IF %>>MenuItem1</option> <option <%IF FP_FieldVal(fp_rs,"myFieldName") = "MenuItem2" THEN Response.Write(" selected") END IF %>>MenuItem2</option> <option <%IF FP_FieldVal(fp_rs,"myFieldName") = "MenuItem3" THEN Response.Write(" selected") END IF %>>MenuItem3</option> Just taking a wild guess.... Edited by - rdouglass on 12/04/2001 16:18:27
|
|
|
|
JeroenDortmans
Posts: 66 From: Eindhoven Netherlands Status: offline
|
RE: Update drop down list contents - 12/5/2001 17:44:47
Hi rdouglass, I am almost there. I see the entry as it is in the database. But the other 2 options are not displayed, but the drop down box is 3 rows long. When I select one of the 2 empty fields and run an update query on the page the entry in the database is updated with another value than there was before. One thing what also isn't Wright is that the value as it is in the database isn't automatically on top of the drop down box. Any further suggestions? Here is the code like I used. <select size="1" name="status"> <option value="Overige"><%IF FP_FieldVal(fp_rs,"status" = "Overige" THEN Response.Write("Overige") END IF%> </option> <option value="Oud"><%IF FP_FieldVal(fp_rs,"status") = "Oud" THEN Response.Write("Oud") END IF%> </option> <option value="Actueel"><%IF FP_FieldVal(fp_rs,"status") = "Actueel" THEN Response.Write("Actueel") END IF%> </option> </select></td>
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Update drop down list contents - 12/5/2001 22:04:46
<select size="1" name="status"> <option value="Overige" <%IF FP_FieldVal(fp_rs,"status" = "Overige" THEN Response.Write("selected") END IF%>>Overige </option> <option value="Oud" <%IF FP_FieldVal(fp_rs,"status") = "Oud" THEN Response.Write("selected") END IF%>>Oud </option> <option value="Actueel"><%IF FP_FieldVal(fp_rs,"status") = "Actueel" THEN Response.Write("selected") END IF%>>Actueel </option> </select></td> §þððk¥ Database / DRW Q & A VP-ASP Shopping cart
|
|
|
|
JeroenDortmans
Posts: 66 From: Eindhoven Netherlands Status: offline
|
RE: Update drop down list contents - 12/6/2001 3:48:42
Hi there, rdouglass thank you for the start and Spooky tank you for the final code. It works fine now. This way I can have one page which I can use to display database results and update them by sending the page information to an update query. Thank you, Thank you, Thank you!
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|