View Single Post
  #1 (permalink)  
Old Feb 11th, 2008, 21:46
Higel Higel is offline
New Member
Join Date: Feb 2008
Location: Australia
Age: 23
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Advice on obtaining an object using javascript.

Hi all,

This is my first post and is definately going to show my Javascript inexperience though i hope with a bit of persistance I can become more equipped to program using this language.

Currently i'm having a problem understanding how to retrieve an array of objects (in this case javaFaces SelectItems) within javascript.

I have created a hidden field in my jsp page because my understanding is you cannot parse through a parameter from jsp to java:

Code: Select all
<h:form id="test"> <h:inputHidden id="arrayOfSelectItems" value="#{arrayOfSelectItems}" />
</h:form>


The value is obtained from my java page.

My problem is using this ArrayOfSelectItems for use withing my javascript code. I've hunted to find examples without luck. I have tried the following code.

Code: Select all
var list = document.getElementById("test:arrayOfSelectItems");
which will allow me to see an output of (javax.face.model.SelectItem, javax.faces.model.SelectItem, etc) when i use list[0].value. So i can see the objects though cannot access the data within.

Am i on the right track using this javascript method or is there another way objects are supposed to be used?

Any help or push in the right direction would be greatly appreciated.

Thankyou


Last edited by CloudedVision; May 27th, 2008 at 23:09. Reason: Code tags
Reply With Quote