Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old February 11th, 2008, 05:46 PM   #1
New Member
 

Join Date: Feb 2008
Location: Australia
Age: 25
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Higel is on a distinguished road
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:
<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:
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 07:09 PM.. Reason: Code tags
Higel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 27th, 2008, 02:05 PM   #2
WebForumz Member
 

Join Date: Aug 2006
Location: Peru
Age: 23
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 QuikFrozen is on a distinguished road
Re: Advice on obtaining an object using javascript.

var value = document.getElementById("arrayOfSelectItems") .value; will give you the value of the hidden input.
QuikFrozen is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Advice A800 JavaScript 2 March 11th, 2008 08:54 AM
Confusion between DOM element and javascript object coolxo JavaScript 3 October 22nd, 2007 07:38 PM
Javascript Copy to clipboard Object Error andrewlondon JavaScript 1 September 24th, 2007 09:15 AM
Object ID firefox help russtuk HTML, XHTML and CSS 1 May 21st, 2007 11:21 AM
Obtaining a value from a field before submission ClaireB Classic ASP 2 October 5th, 2005 02:41 PM


Search Engine Optimization by vBSEO 3.2.0 RC8