onClick javascript.

L.S.

I implemented a master-detail relationship in my app using the following lines of code in the onClick Javascript property of a hyperlink in a table:

window.open(?Fitwise/faces/OnderneminDetails.jsp?idBedrijf=#{currentRow.value[ 慴edrijf.idBedrijf抅}? 揰blank? 揾eight=432, resizable=yes, scrollbars=yes, toolbar=yes, width=576?; return false;

This works fine. In the details page I get the idBedrijf from the parameter and set it as the value of a private property idBedrijf with its own getter and setter methods.

Now I would like to open another window when the user clicks an ImageHyperlink in the detailspage. For this to work properly I have to transfer the idBedrijf to that page. I used the following lines of code in the onClick Javascript property of the ImageHyperlink:

window.open(?Fitwise/faces/ODLesrooster.jsp?idBedrijf=#{getIdBedrijf()]}? 揰blank? 揾eight=600, resizable=yes, scrollbars=yes, toolbar=yes, width=800?; return false;

This does not work. I suppose it is the getIdBedrijf() bit of code that is wrong, what do I have to replace it with to get the onClick thing working.

Thanks,

Annet.

[1166 byte] By [JagXa] at [2007-11-26 16:24:22]
# 1

Not sure if I follow exactly what's happening here however looking at your EL expression I can suggest you try changing it to:

...ooster.jsp?idBedrijf=#{idBedrijf}....

or maybe try #{whateverBean.idBedrijf}

In general in EL you normally leave out the "get" or "set" part of the pattern thus property "someProperty" on page bean "Page1" with methods "getSomeProperty()" and "setSomeProperty()" is referenced by "#{Page1.someProperty}"

yossariana at 2007-7-8 22:48:16 > top of Java-index,Development Tools,Java Tools...
# 2

Thanks for your reply yossarian,

I replaced the Image Hyperlink with a Hyperlink and got the code working. However I cannot figure out why it does not work when I use an Image Hyperlink. I replaced the code with the simple window.close(); return false; bit of code,of which I am sure it works fine with a Hyperlink, but when I run the project, clicking on the Image Hyperlink does not have any effect at all. I did use an Image Hyperlink with an action event on another occassion, but, since I would like to open a new window, I would rather use the onClick javascript option to implement this behaviour.

Any ideas what the problem is?

Thanks,

Annet.

JagXa at 2007-7-8 22:48:16 > top of Java-index,Development Tools,Java Tools...