Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 6199 invoked from network); 28 Jun 2006 19:47:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Jun 2006 19:47:09 -0000 Received: (qmail 61494 invoked by uid 500); 28 Jun 2006 19:47:04 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 61248 invoked by uid 500); 28 Jun 2006 19:47:03 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 61237 invoked by uid 99); 28 Jun 2006 19:47:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jun 2006 12:47:03 -0700 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_WHOIS,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [206.190.53.31] (HELO smtp106.plus.mail.re2.yahoo.com) (206.190.53.31) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 28 Jun 2006 12:47:01 -0700 Received: (qmail 41041 invoked from network); 28 Jun 2006 19:46:40 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:X-Mailer:In-Reply-To:Thread-Index:X-MimeOLE; b=FEgqwW7b9bF/JXcrSY1acUSt/5e0R1UEu0O3pRRF6ZNIPtThFebRyLIbbejwytEiwXgxUiGhPCuN2A07/89IQsQkTXJC4uty2WWeEhWy391BcO+g6vmTXoj1LB4Xsb0OEDDoAu/1icV9iWulABNw0XOGxwvmKjp/RJCrv1Hv2zA= ; Received: from unknown (HELO laptop) (julianjray@24.91.251.40 with login) by smtp106.plus.mail.re2.yahoo.com with SMTP; 28 Jun 2006 19:46:39 -0000 From: "Julian Ray" To: "'MyFaces Discussion'" Subject: RE: Design Type Question Date: Wed, 28 Jun 2006 15:46:41 -0400 Message-ID: <001101c69aeb$960c7a30$6701a8c0@laptop> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0012_01C69ACA.0EFADA30" X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Acaa6ejGSVxxWv1fQ/STw61EKWHlXgAATPYA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C69ACA.0EFADA30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Great. How about adding how you did it to the wiki and pass on your know-how as I'm sure others will be facing the same problem :) _____ From: Gregg Bolinger [mailto:gdboling.myfaces@gmail.com] Sent: Wednesday, June 28, 2006 3:33 PM To: MyFaces Discussion Subject: Re: Design Type Question New info. If I place all this code in a function and call that function on document load, it works fine. So I guess I'll just go that route. On 6/28/06, Gregg Bolinger wrote: Alright. Thanks for the info. Getting closer. I have the following being spit out on my page after rendered. var options = document.getElementById('catSelect').options; var option = new Option('4', 'Active'); options[options.length] = option; var option = new Option('69', 'Appreciate'); options[ options.length] = option; var option = new Option('3', 'Explore'); options[options.length] = option; var option = new Option('71', 'Habitat'); options[options.length] = option; var option = new Option('70', 'Indulge'); options[options.length] = option; var option = new Option('1', 'Locate'); options[options.length] = option; var option = new Option('2', 'People'); options[options.length] = option; And I am getting document.getElementById("catSelect") has no properties error. I also see this on the rendered HTML: Which is accurate as to: Anything jump out? On 6/28/06, Julian Ray < julianjray@yahoo.com > wrote: No if you use selectOne components which update the backingbean. Your JS should reference the selectOne components via ids - you might have to pass dummy select items but these will get removed then replaced by the JS as it loads. Remember that the page is rendered before its loaded by the browser so the JS will execute after the rendering has been performed. _____ From: Gregg Bolinger [mailto:gdboling.myfaces@gmail.com] Sent: Wednesday, June 28, 2006 3:05 PM To: MyFaces Discussion Subject: Re: Design Type Question Ok, got it working now. One final question. If I do this with Javascript, I am going to have to do all the work of updating the model with the new values since it's client side, correct? Maybe this should be my first custom component. Eh? lol. Thanks for the help. Gregg On 6/28/06, Gregg Bolinger wrote: Scratch that. I am getting the value. But all the code is escaped. >, < etc. So it doesn't register correclty. Trying something else.... On 6/28/06, Gregg Bolinger wrote: Alright, maybe a stupid question... For testing I have a property in my backing bean called javascript with getters and setters. I have initialized javascript with the following: private String javascript = ""; And then did: t:outputText value="#{ArticleListBean.javascript}"/> But it's not spitting out the code. Am I doing this wrong? Thanks. On 6/28/06, Julian Ray wrote: Make sure to use forceId on the select items so the JS can find them otherwise you will have to prefix the component ids with "formname:" _____ From: Gregg Bolinger [mailto:gdboling.myfaces@gmail.com ] Sent: Wednesday, June 28, 2006 2:31 PM To: MyFaces Discussion Subject: Re: Design Type Question Doh! Didn't even think about that. Thanks. On 6/28/06, Julian Ray wrote: Couldn't you use a
Great. How about adding how you did it to the = wiki and pass=20 on your know-how as I'm sure others will be facing the same problem = :)


From: Gregg Bolinger=20 [mailto:gdboling.myfaces@gmail.com]
Sent: Wednesday, June 28, = 2006=20 3:33 PM
To: MyFaces Discussion
Subject: Re: Design = Type=20 Question

New info.  If I place all this code in a function and = call that=20 function on document load, it works fine.  So I guess I'll just go = that=20 route.

On 6/28/06, Gregg=20 Bolinger <gdboling.myfaces@gmail.com= >=20 wrote:
Alright.  Thanks for the info.  Getting closer.  I = have=20 the following being spit out on my page after = rendered.

var=20 options =3D document.getElementById('catSelect').options;
var option =3D new Option('4', = 'Active');
options[options.length] =3D option;
var option =3D new Option('69', = 'Appreciate');
options[ options.length] =3D option;
var option =3D new Option('3', = 'Explore');
options[options.length] =3D option;
var option =3D new Option('71', = 'Habitat');
options[options.length] =3D option;
var option =3D new Option('70', = 'Indulge');
options[options.length] =3D option;
var option =3D new Option('1', 'Locate'); =
options[options.length] =3D option;
var option =3D new Option('2', 'People'); =
options[options.length] =3D option;

And I am = getting=20
document.getElementById("catSelect") has no properties = error.  I=20 also see this on the rendered HTML:

<select = id=3D"catSelect"=20 name=3D"catSelect" size=3D"1"> <option=20 value=3D"0">ALL</option></select>

Which is = accurate as to:=20

<t:selectOneMenu forceId=3D"true" id=3D"catSelect"=20 value=3D"#{ArticleListBean.category}">
    =20 <f:selectItem itemLabel=3D"ALL" itemValue=3D"0"=20 />
</t:selectOneMenu>

Anything jump=20 out?
           =20        


On 6/28/06, Julian=20 Ray < = julianjray@yahoo.com=20 > wrote:
No if=20 you use selectOne components which update the backingbean. Your JS = should=20 reference the selectOne components via ids - you might have to pass = dummy=20 select items but these will get removed then replaced by the JS as = it loads.=20 Remember that the page is rendered before its loaded by the browser = so the=20 JS will execute after the rendering has been=20 performed.


From: Gregg Bolinger = [mailto:gdboling.myfaces@gmail.com] =
Sent: Wednesday, June 28, = 2006 3:05=20 PM

To: MyFaces=20 Discussion
Subject: Re: Design Type=20 Question

Ok, got it working now. One final question.  If I do = this=20 with Javascript, I am going to have to do all the work of updating = the model=20 with the new values since it's client side, correct?  =

Maybe=20 this should be my first custom component. Eh? lol.
Thanks for = the=20 help.

Gregg

On 6/28/06, Gregg=20 Bolinger <gdboling.myfaces@gmail.com> wrote:
Scratch that.  I am getting the value. But all the code = is=20 escaped. &gt;, &lt; etc.  So it doesn't register=20 correclty.  Trying something else....


On 6/28/06, Gregg=20 Bolinger <gdboling.myfaces@gmail.com> wrote:=20
Alright, maybe a stupid question...

For testing I = have a=20 property in my backing bean called javascript with getters and=20 setters.  I have initialized javascript with the=20 following:

private String javascript =3D "<script=20 type=3D\"text/javascript\">function testFunction(){ = alert('this is a=20 test'); }</script>";

And then = did:

t:outputText=20 value=3D"#{ArticleListBean.javascript}"/>

But it's not = spitting=20 out the code.  Am I doing this wrong?


Thanks.


On 6/28/06, Julian Ray <julianjray@yahoo.com> wrote:=20
Make sure to use forceId on the select items so the = JS can find=20 them otherwise you will have to prefix the component ids with=20 "formname:"
 


From: Gregg = Bolinger=20 [mailto:gdboling.myfaces@gmail.com ]=20
Sent: Wednesday, June = 28, 2006=20 2:31 PM

To: MyFaces = Discussion
Subject: Re: Design Type=20 Question

Doh!  Didn't even think about that. =20 Thanks.

On 6/28/06, Julian Ray <julianjray@yahoo.com> wrote:=20
Couldn't you use a <h:outputText=20 value=3D"#{myBackingBean.....}}  /> and either (a) = write out=20 the whole javascript or (b) just write out the array=20 part?
 
 


From: Gregg = Bolinger=20 [mailto:gdboling.myfaces@gmail.com]=20
Sent: Wednesday, = June 28, 2006=20 1:38 PM

To: = MyFaces=20 Discussion
Subject: Re: Design Type=20 Question

Thanks Julian.  *Unfortunately* I'm well = adapt at=20 Javascript so I already know how to do that.  What I = don't know=20 is how to populate Javascript arrays with data from my = backing=20 bean.

Aside from a custom component, I'd assume I = need to do=20 something like that.

Thanks.

On 6/28/06, Julian Ray <julianjray@yahoo.com > wrote:=20
Here is an example, I have not tested it but have = used=20 similar approaches
 
 
 


From: Gregg = Bolinger=20 [mailto:gdboling.myfaces@gmail.com ]=20
Sent: Wednesday, = June 28,=20 2006 11:45 AM
To: MyFaces = Discussion
Subject:=20 Re: Design Type Question

Julian,

Thanks for the = suggestions.  How=20 would I go about populating javascript values with data = from the=20 backing bean if I were to go with [1]?  Any links = with this=20 info?

Thanks.

On 6/28/06, Julian Ray <julianjray@yahoo.com > = wrote:=20
Some suggestions
 
[1] Use client-side population of teh drop=20 downs
[2] Use 2 backing beans, 1 for the drop down = and 1 for=20 the articles. Lazily load all getters. Use t:saveState = to store=20 the filter bean.
[3] Use Ajax


From: Gregg Bolinger = [mailto:gdboling.myfaces@gmail.com ] =
Sent:=20 Wednesday, June 28, 2006 10:20 AM
To: MyFaces=20 Discussion
Subject: Design Type=20 Question

This isn't about MyFaces specifically so I = apologize=20 but this list is the best JSF resource I know of. = ;)

I=20 have a page that contains a list of Articles.  = There are=20 also filter criteria to filter the list of = Articles.  The=20 article list is a dataTable who's value is a method in = the=20 backing bean that returns a list of articles.  = Simple=20 enough.  So when the page first loads, I get all = the=20 articles.

The problem I am facing is part of the = filter=20 is 3 levels of categories.  Category, Sub Category, = and a=20 Sub Sub Category.  Each of these is a selectOneMenu = and the=20 child catagories depends on the parent category.  = So I have=20 valueChangeListeners registered so that when one drop = down=20 changes, the child dropdown gets new values.

The = problem=20 with this is that when this happens, my method to get = the list=20 of articles is called.  But I don't want this to = happen=20 until I click the Search button.  So I am just = looking for=20 solutions to solve this. =

Thanks.



=

<= BR>

=

<= BR> ------=_NextPart_000_0012_01C69ACA.0EFADA30--