Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasted code -- Pls tell me how to retrive hidden value in jsp variable

Status
Not open for further replies.

Ajith2002

Programmer
Jul 16, 2002
30
US
Hi,

I have a hidden field called "hRank". And in "selectChange" function i am passing the index of drop down list as a parameter, which is stored in "intSelectedValIndex" and storing it in "hRank", as shown in the function below.
Please tell me how to retrive that "hRank" value.
So that i can use that value instead of "3" which now i have hardcoded.

"CaseType = CaseTypeLevel1List.getItem(3)"
I dont want to reload the page.

I have pasted the same code below. I am trying this for a long time, but hvnt got a solution. Please help.

thanks,
Tina.


function selectChange(intSelectedValIndex,controlToPopulate)
{
window.document.form1.hRank.value=intSelectedValIndex;
var intRank = intSelectedValIndex;
var myEle;

<%
//String fid = request.getParameter(&quot;hRank&quot;);
//int id = Integer.parseInt(fid);


CaseType = CaseTypeLevel1List.getItem(3);
CaseTypeLevel2List = CaseType.getChildChoiceList();
if(CaseTypeLevel2List != null)
{
for(int nLevel2 = 1; nLevel2<= CaseTypeLevel2List.getCount(); nLevel2++)
{
%>

myEle = document.createElement(&quot;option&quot;) ;
myEle.value = &quot;<%=nLevel2 %>&quot;
myEle.text = &quot;<%=CaseTypeLevel2List.getItem(nLevel2).getTitle()%>&quot;
controlToPopulate.add(myEle) ;
<%
}
}
%>

}

 
Bit confused on this one....looks as though you are trying to retrieve the value of the drop down and use it in the JSP.

The JSP code is run on the server and then the result is delivered to your browser (where the HTML and javascript is used). If you want to use the values in a form to do things in a JSP you will have to re-request the JSP when the drop down has changed and use the re-submitted information.

That would be when you can use :
request.getParameter(&quot;hRank&quot;);

Am I misunderstanding?

Kev

[afro2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top