/    Sign up×
Community /Pin to ProfileBookmark

variable’s values into an address query

Hi!!

I am implementing a program using java servlets but I need a javascript function to do the following:

I have a combo box with numbers on it, and I want that every time that a user selects a value from the combo box, it appears as many text boxes as the value selected.

What I have done is that on the event onChange of the combo box, I call to a javascript function that receives 3 parameters, one of wich is the value selected in the combo.
In that function I want to recall a servlet passing it the values that the function receives.
Here it is the example of the code I have done:

<HEAD>
<SCRIPT LANGUAGE=”JavaScript”>
function displayTexts(num, text, combo_value) {
window.open(“./Servlet?option=2&line=num&question=text&nanswers=combo_value”)
}
</SCRIPT>
</HEAD>

The problem is that using that way, the variables passed to the function will be passed into the servlet as literals and not as their value because they are enclosed into the address query.

How can I pass the variable’s values into the address query?

?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@theBody44May 11.2004 — I could be wrong because I've never tried this, but just break up your servlet string...

"...someParameter=" + variable + "&otherParam=" + var2 + "..."

That should get you the variable values instead of literals
×

Success!

Help @221436 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.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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

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