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.

Hope I've made sense, you may be able to tell I'm a bit of a newbie!

Any help would be really appreciated!

Thanks in advance

Re: editable dropdown/list field by Evertjan

Evertjan
Tue Jul 08 04:57:57 CDT 2008

Paul wrote on 08 jul 2008 in microsoft.public.inetserver.asp.general:

> 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.
>
> Hope I've made sense, you may be able to tell I'm a bit of a newbie!

ASP has no dropdown lists, you will need to do this clientside.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: editable dropdown/list field by Bob

Bob
Tue Jul 08 10:57:40 CDT 2008

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"



RE: editable dropdown/list field by OldPedant

OldPedant
Tue Jul 08 14:24:03 CDT 2008

What you are looking for is what Windows calls a "combo-box". And it's a
quite common feature in Windows-based forms.

But HTML doesn't support one. At least not directly.

It's not too hard to create the *appearance* of one using JavaScript, but if
you intend it to work with all browsers you have to be pretty careful in
constructing it.

You might do a Google search for "html combo box" or "javascript combo box"
and see if you get any hits.

As Bob Barrows showed, it's pretty easy to get the same functionality by
using both a <SELECT> and an <INPUT> field, but yes, if you can do it
"prettier" using JS and CSS it can have a nice effect.


Re: editable dropdown/list field by Paul

Paul
Fri Jul 11 04:08:10 CDT 2008

Many thanks for your assistance.

After everything, I cheated a bit and just made a link to another form which
allowed me to do what i wanted!

thanks again
"Paul" <Paul@here.local> wrote in message
news:DD2647EF-E4D5-43FF-81A2-F4E55214A0F4@microsoft.com...
> 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.
>
> Hope I've made sense, you may be able to tell I'm a bit of a newbie!
>
> Any help would be really appreciated!
>
> Thanks in advance