Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - <SELECT> not limited to list
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closed<SELECT> not limited to list

 Post Reply Post Reply
Author
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Direct Link To This Post Topic: <SELECT> not limited to list
    Posted: 05 September 2003 at 2:53am

Not sure if this is possible with <SLEECT> or anything similar....

Basically, I have an asp order form which includes delivery details (company, address, etc). There is a table which contains aon address book which I want to put into a <SELECT> so that the users can choose a company and the form will self-populate with the associated address details - no problems.

However, I dont want to limit the user to the <OPTION>'s in the <SELECT> list. I want them to be able to type in other company names (ie not limited to the list).

Is this possible with <SELECT>, is there something else that I should be using, or am I thinking of some other technology (eg Visual Basic / MS Access forms) ???

Cheers

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Direct Link To This Post Posted: 05 September 2003 at 12:07pm

One possible Solution:

Form Code:
<SELECT NAME="selectCompany">
<option value="company1">Company 1</option>
<option value="company2">Company 2</option>
<option value="company3">Company 3</option>
</SELECT>
or
<INPUT TYPE="text" NAME="inputCompany">

ASP Code:
<%
Dim userCompany, selectCompany, inputCompany
selectCompany = Request.Form("selectCompany")
inputCompany = Request.Form("inputCompany")
If Not selectCompany = "" Then
userCompany = selectCompany
ElseIf Not inputCompany = "" Then
userCompany = inputCompany
End If
%>

Back to Top
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Direct Link To This Post Posted: 06 September 2003 at 1:54pm

That is the only solution that I am aware of....

What I am after is a single entry point rather than the option of selecting from a <SELECT> or entering into an <INPUT>.

I guess my requirement is just not possible

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Direct Link To This Post Posted: 07 September 2003 at 9:17am

well, there's no way to enter text in to a <select> box of course...

I guess there would be a way to scroll through the company names in a text box with JavaScript, so the user could either choose one of them or enter their own...

Back to Top
Bluefrog View Drop Down
Senior Member
Senior Member


Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
Direct Link To This Post Posted: 19 September 2003 at 9:44am

The solution here isn't obvious. Create another option like <option value="custom"> Enter a new company...</option>.

Add an onChange event to the SELECT tag. Pass the value to a javascript function.

In the JS function, unhide a hidden INPUT element. Prompt the user to enter the new thing.

Have a button that says something like "Add company". Get the user to click it.

With the button, have an onClick event. With that, grab the value in the INPUT element...

Use:

document.formName.selectName.options[document.formName.selec tName.selectedIndex].value

To access and replace 'custom'.

Hide the INPUT.

Tada.

Sorry I don't have more time to give you working code, but that will do it if you fiddle around and do it in small pieces.

The trick is that you never 'CHANGE' the select... you only unhide an INPUT, get what you want, then replace/add a new field in the SELECT. (There are a few extras that you'll need to do as well, but that should get you started.)

Cheers

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.