Pass hidden variable to new window

Hi,

I have a value in a JSP hidden variable. I need to pass this as a parameter to a new window. The code is something like this -

window.open('newFile.jsp?accountId=document.myForm.hiddenField.value','myWindow', 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=750,height=650');

I am passing - document.myForm.hiddenField.value as a parameter. If I put an alert and view the contents it shows up correctly as '123' . But when my java class does req.getParameter("accountId"), it shows up as a string - 'document.myForm.hiddenField.value'.

What am I doing wrong?

Thanks in advance.

[674 byte] By [arbitarya] at [2007-10-2 18:47:57]
# 1

You need to construct the string - concatenate the static string with a javascript variable

I would do it like this.

// calculate the url to open

var url = 'newFile.jsp?accountId=' + document.myForm.hiddenField.value;

// open the window, using that calculated url.

window.open(url,'myWindow', 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=750,height=650');

evnafetsa at 2007-7-13 20:10:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks! It worked.
arbitarya at 2007-7-13 20:10:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...