/    Sign up×
Community /Pin to ProfileBookmark

Function needed for form input text field

Hi,

I would like to avoid using a form select field (due to CSS and Internet Explorer bugs) and am wondering if there is a JS function or JS code that can be referenced that allows the user to choose a value from an array list and when selected, place that value into the input text field value? I’m envisioning something like a button that appears right before or after the input text field that says something like, “choose input values”, and when clicked provides a pop-up window of values to choose from. When the value is chosen, this value would be put into the form’s input text field value. I am a beginner to JS so any help would be greatly appreciated. Thanks in advance!

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangApr 29.2006 — form select field (due to CSS and Internet Explorer bugs)[/QUOTE] ?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>select</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body>

<form action="#" name="form1">
<fieldset><legend>Links</legend>
<select name="sites" onchange="document.getElementById('choise').value=(this.value!='')? this.value : '';">
<option value="">Select one</option>
<option value="http://www.bbc.co.uk/">BBC</option>
<option value="http://www.google.com">Google</option>
</select>
<input id="choise" type="text" disabled>
</fieldset>
</form>

</body>
</html>
×

Success!

Help @Sue_K spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...