Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

hidden variable  RSS feed

 
Raghuram Kristipati
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not getting the values in the secondjsp when i am passing the variable through the hidden variable. Please tell me where i did the mistake.

Below is the piece of code i wrote...

Firstjsp:
function selectChanged(obj){
alert(obj);
if(obj=='English'){
document.inputform.valsel.value = obj;
alert(document.inputform.valsel.value);
document.inputform.submit();
}
}
</script>
<BODY>
<P><form name="inputform" method="post" action="raghutest.jsp" >

Language :

<select NAME="language" size=1 onChange="javascript:selectChanged(value)">
<option value="English" >English
<option value="Germany" >Germany
<option value="Spanish" >Spanish
<option value="Japanese" >Japanese
</select>
<br>
<input type=hidden name="valsel">



SecondJsp:

<% String abc=request.getParameter("valsel");%>
valueSelected = <%=abc%>
 
sahitya lakshmi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
try the following code its working
Fir.jsp

<script language="javaScript">
function selectChanged(obj)
{
alert(obj);
if(obj=="English")..........here double quotation
{
document.inputform.valsel.value = obj;
alert(document.inputform.valsel.value);
document.inputform.submit();
}
}
</script>
<BODY>
<P>
<form name="inputform" method="post" action="sec.jsp" >

Language :

<select NAME="language" size=1 onChange="javascript:selectChanged(value)">
<option value=""></option>....................u doesnot kept this one
<option value="English" >English
<option value="Germany" >Germany
<option value="Spanish" >Spanish
<option value="Japanese" >Japanese
</select>
<br>
<input type=hidden name="valsel">
sec.jsp
<% String abc=request.getParameter("valsel");%>
valueSelected = <%=abc%>
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello PQR-

You have been reminded of the JavaRanch policy on screen names before. Please fix yours right here. Accounts without valid screen names are generally closed. Thanks for your prompt attention to this matter.
 
Alan Mehio
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you change this
....onChange="javascript:selectChanged(value)">
To this
....onChange="javascript:selectChanged(this.options[this.selectedIndex].value)">

Please try it
Regards,
Alan Mehio
London, The City
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!