/    Sign up×
Community /Pin to ProfileBookmark

capture selected text from the list menu

hi

i’m trying to capture a selected text from the list menu. however i tried many times but to no avail.
the following jsp codings are my list menu.. notice tat wat i capture are retrive from my database, therefore its not like those normal list menu..

<%
out.println(“<select name=’site_name’ >”);
out.println(“<option>=====Actual Site Name=====</option>”);
for(int i=0;i<actualAL.size();i++)
{
out.println(“<option>”+actualAL.get(i)+”</option>”);
}
out.println(“</select>”);
%>

and below is my ‘hidden’ field and it is also where i would like to capture the selected text..

<input type=”hidden” name=”message” value=””>

the list menu and ‘hidden’ fields are at the same page..

I’v tried many mtd, but wat i capture is always empty fields.. can anyone tel mi wat to do? i need it urgently..

thks

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@PittimannJan 07.2004 — Hi!

You could try something like this:
[code=php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name="myForm">
<%
out.println("<select name='site_name' onChange='document.myForm.message.value=document.myForm.site_name.value;'>");
out.println("<option>=====Actual Site Name=====</option>");
for(int i=0;i<actualAL.size();i++)
{
out.println("<option value='"+actualAL.get(i)+"'>"+actualAL.get(i)+"</option>");
}
out.println("</select>");
%>
<input type="hidden" name="message" value="">
</form>
</body>
</html>
[/code]

Cheers - Pit
×

Success!

Help @mistgal 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.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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