/    Sign up×
Community /Pin to ProfileBookmark

text box and drop down menus

I am new to javascript so I am sure I am completely missing something. I could post my script but its kind’ve big and clunky, but I’ll post it on request. I was wondering if some one could just show me an example of a drop down menus value being added to the end of a text box value when submitted.

for example:

textbox value=”a”
dropdown value=”2″

so when submitted it submits as “a2”

thanks.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@shane_carrNov 03.2007 — Try something like this:

[code=html]<form action="script.php" onsubmit="combineValues();">
<input type="text" id="temptext" />
<select id="tempselect">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="text" id="combinedvalue" />
</form>[/code]


function combineValues(){
document.getElementById("combinedvalue").value = document.getElementById("temptext").value+document.getElementById("tempselect").options[document.getElementById("tempselect").selectedIndex].value;
}
Copy linkTweet thisAlerts:
@rabitauthorNov 03.2007 — thanks, i was able to get that part of my script working. i appreciate it.
×

Success!

Help @rabit 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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