General discussion

Locked

DreamWeaver Drop Down Lists

By csanosi ·
I am building a web site using dreamweaver ultra dev. The site will update a database, as well as pull information from the same database. Here is my problem. I have an update page that will allow users to update their information. On this page I use drop down lists for certain fields. The problem is that I cannot figure out how to have the drop down list default to the current entry in the database, therfore the user always has to select the value in this field everytime they update any value on the page. If anyone knows a workaround for this, I would greatly appreciate it.

Thanks
Chris

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

DreamWeaver Drop Down Lists

by AlterEgo2 In reply to DreamWeaver Drop Down Lis ...

Thats a vague question... whats a default in this case?
At a guess you could:

1)Add a field in your db table which flags a particular row as current/live status. Then either in your query or at code level sift this value out as the initial valuefor the drop down list.

2)If I got that wrong and you just want to persist values after submitting a form use a querystring or hidden form fields.

Hope that helps (next time put a little more info in your question)

benwh1te@yahoo.com

Collapse -

DreamWeaver Drop Down Lists

by csanosi In reply to DreamWeaver Drop Down Lis ...

Poster rated this answer

Collapse -

DreamWeaver Drop Down Lists

by csanosi In reply to DreamWeaver Drop Down Lis ...

Here is some info. I have a db field that contains a list of names. When the record containing this field is edited, this is one of the fields that can be changed. The field is on the form as a drop-down list. The problem is that the list displays the first name in the list as opposed to the name currently in the db field. Here is an example...
I have the following list of names (mike, jon, bob, frank) stored in that order in a database. I have a table in the database that contains a field populated from this list. If the value on the record is "bob", when I pull up that record to edit it, the list will disply "mike". Therefore unless I select "bob" from the dropdown list when I update the record, it will change the value to "mike".
I hope this clears it up.

Collapse -

DreamWeaver Drop Down Lists

by agibbs In reply to DreamWeaver Drop Down Lis ...

I'm not familiar with DreamWeaver UltraDev, but here's how I always do it with Visual InterDev (using ASP)

<%
'set user's current entry
usersfield = "value1"

'initiate DB connection
set rsTemp = server.createobject("ADODB.Recordset")
rsTemp.open "SELECT field FROM table","DSN=mydsn"

'loop through rsTemp and display list values in listbox.
' Note that for each iteration of the loop I check the value of the current field to see if it matches the user's field, if it does, I write a "selected" into the listbox so that list item wlil be selected
%>
<select name="select">
<%
while not rsTemp.eof
%><option value="<%=rsTemp("field")%>" <%if rsTemp("field") = usersfield then response.write "selected"%></option><%
rsTemp.movenext
wend
%>
</select>


Of course, if you're using UltraDev to write PHP code that probably just looks like a bunch of jibberish :-)

Later,
Aaron

Collapse -

DreamWeaver Drop Down Lists

by csanosi In reply to DreamWeaver Drop Down Lis ...

Poster rated this answer

Collapse -

DreamWeaver Drop Down Lists

by csanosi In reply to DreamWeaver Drop Down Lis ...

This question was closed by the author

Back to Web Development Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums