Using Drop down menus to edit a record (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


DKN -> Using Drop down menus to edit a record (10/8/2001 20:17:00)

I know its possible to use a drop down menu to create a new record but can you use drop down menus to edit a record. Say when a user clicks on a certain record a paramater is used to pull that specific record from the database to the edit page. Usually this page is all text boxes. Is it possible to use drop down menus again with this edit page?




Spooky -> RE: Using Drop down menus to edit a record (10/8/2001 18:57:00)

Yes it is, but there needs to be a way to check that the first view is the current record and not the default (top) value of the drop down list.

eg:

<option name="1" Value="1" <%If DatabaseValue="1" then Response.write " selected"%>>Value 1</option>
<option name="2" Value="2" <%If DatabaseValue="2" then Response.write " selected"%>>Value 2</option>





DKN -> RE: Using Drop down menus to edit a record (10/9/2001 14:34:00)

Could you take a quick look at this code and tell mw what Im doing wrong.

<td width="109" bgcolor="#C0C0C0"><b>Project Mgr:</b></td>
<td width="626"><select size="1" name="Project Mgr">
<option name="1" Value="John Mueller" <%If "ProjectMgr"="1" then Response.write " selected"%>>John Mueller</option>
<option name="2" Value="Darren Nichols" <%If "ProjectMgr"="2" then Response.write " selected"%>>Darren Nichols</option>
<option name="3" Value="Darrell Fox" <%If "ProjectMgr"="3" then Response.write " selected"%>>Darrell Fox</option>

</select></td>





rdouglass -> RE: Using Drop down menus to edit a record (10/9/2001 15:04:00)

I think you're just grabbing your field values incorrectly. I think it should be something like:

<td width="109" bgcolor="#C0C0C0"><b>Project Mgr:</b></td>
<td width="626"><select size="1" name="Project Mgr">
<option name="1" Value="John Mueller" <%If fp_fieldVal(fp_rs,"ProjectMgr")="1" then Response.write " selected"%>>John Mueller</option>
...etc...

That is if you're pulling info from a DB. If you're pulling it from a POSTing form, use:

<option name="1" Value="John Mueller" <%If Request.Form("ProjectMgr")="1" then Response.write " selected"%>>John Mueller</option>

[This message has been edited by rdouglass (edited 10-09-2001).]





DKN -> RE: Using Drop down menus to edit a record (10/9/2001 17:11:00)

This is coming from the database. I tried this code with still no luck.

<td width="109" bgcolor="#C0C0C0"><b>Project Mgr:</b></td>
<td width="626"><select size="1" name="ProjectMgr">
<option name="1" Value="John Mueller" <%If FP_FieldVal(fp_rs,"ProjectMgr")="1" then Response.write " selected"%>>John Mueller</option>





Spooky -> RE: Using Drop down menus to edit a record (10/9/2001 21:27:00)

If you have a "Value=John Mueller" then the FP_FieldVal(fp_rs,"ProjectMgr") will also have to equal "John Mueller"

Unless you are using the priamry autonumber
field, and the value for John Mueller is "1"

It thats the case,then "value" will also have to equal "1"

So to clarify :

<option Value="John Mueller" <%If FP_FieldVal(fp_rs,"ProjectMgr")="John Mueller" then Response.write " selected"%>>John Mueller</option>

This assumes the list box is INSIDE the DRW area so that that function is valid.


------------------
§þððk¥
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!
VP-ASP Shopping cart





DKN -> RE: Using Drop down menus to edit a record (10/11/2001 20:26:00)

That worked like a charm. Thanks much Spooky




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.09375