Advice on obtaining an object using javascript.

This is a discussion on "Advice on obtaining an object using javascript." within the JavaScript Forum section. This forum, and the thread "Advice on obtaining an object using javascript. are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 11th, 2008, 21:46
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

  #2 (permalink)  
Old May 27th, 2008, 18:05
Up'n'Coming Member
Join Date: Aug 2006
Location: Peru
Age: 21
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Advice on obtaining an object using javascript.

var value = document.getElementById("arrayOfSelectItems") .value; will give you the value of the hidden input.
Reply With Quote
Reply

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 Forum 2 Mar 11th, 2008 11:54
Confusion between DOM element and javascript object coolxo JavaScript Forum 3 Oct 22nd, 2007 23:38
Javascript Copy to clipboard Object Error andrewlondon JavaScript Forum 1 Sep 24th, 2007 13:15
Object ID firefox help russtuk Web Page Design 1 May 21st, 2007 15:21
Obtaining a value from a field before submission ClaireB Classic ASP 2 Oct 5th, 2005 18:41


All times are GMT. The time now is 04:45.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43