Paul wrote:
Hi all,
I have a page that has a form on it which has a dropdown list on it.
It connect to an sql database and populate the list. What I would
like to do is make the list editable so that if the data returned
doesnt contain what I want, I can type in the data I require which
will then be updated to the database when the form is posted.
Your question does not make clear whether you wish to use the new value in
subsequent dropdown lists, or whether you just want to process the value but
leave the dropdown list unaltered. I will assume that you want the value to
appear in subsequent dropdown lists.
Hope I've made sense, you may be able to tell I'm a bit of a newbie!
Any help would be really appreciated!
You will need to use an additional input element whose name is set to
"txtNewListValue" for example.
When the form is submitted, the server-side code asp page that is requested
needs to check to see if any text was entered in the element, like this:
<%
....
'Do this before opening the recordset from which the
'dropdown values are generated
dim dropdownvalue
if len(Request.Form("txtNewListValue")) 0 then
'use ADO to insert the new value into the database
dropdownvalue=Request.Form("txtNewListValue")
else
dropdownvalue=Request.Form("dropdownelement")
end if
....
open the recordset from which the
'dropdown list is populated
%.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"