Exactly. I was thinking of a *submit*. But now that I thought about it, a submit may not be needed. But I tend prefer having every possible option available for me to handle whatever scenario I may face. I'll go with the ajax option. Thank you.
*---------------------* *Muhammad Gelbana* http://www.linkedin.com/in/mgelbana On Sun, Jul 13, 2014 at 12:26 PM, Geoff Callender < geoff.callender.jumpst...@gmail.com> wrote: > Sorry, that sounds very odd to me. "refresh the page without refreshing > it" sounds like a contradiction! > > Your Select has made an AJAX request. Why wouldn't you want an AJAX > response, ie. a partial render? If you return the whole page then any other > changes on the client-side will be overwritten, by a server that doesn't > know what was there except for the value of the Select and any context. > > Your question is making me think what you really want is to trigger a > submit of the enclosing form when the Select value changes. That way the > server-side will get the whole picture and be able to do a suitable > non-AJAX response. > > On 13 Jul 2014, at 8:06 pm, Muhammad Gelbana <m.gelb...@gmail.com> wrote: > > > Its ok to use Ajax, but is it the only way to update the page after a > > value is changed in a Select component ? If yes, wouldn't it be an > > improvement to be able to refresh the page without refreshing it and > > losing its state ? > > > > *---------------------* > > *Muhammad Gelbana* > > http://www.linkedin.com/in/mgelbana > > > > > > On Sun, Jul 13, 2014 at 9:44 AM, Geoff Callender < > > geoff.callender.jumpst...@gmail.com> wrote: > > > >> By returning "this" you're doing a page refresh, which is an HTTP 302 > >> redirect, instead of an AJAX response. > >> > >> The redirect causes the browser to issue a second request - a fresh page > >> request - which will be freshly rendered by your stateless page class > >> without any knowledge of the value you set in the previous request. You > can > >> see the 302 response and the second request with the browser's web > >> inspector or firebug. > >> > >> Here's a working example: > >> > >> > >> http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/select1 > >> > >> Cheers, > >> > >> Geoff > >> > >> On 12 Jul 2014, at 11:55 pm, Muhammad Gelbana <m.gelb...@gmail.com> > wrote: > >> > >>> I hope I selected a valid subject ! > >>> > >>> When I handle a VALUE_CHANGED event for a Select component. I receive > the > >>> current value for the Select component as an event handler method > >> parameter. > >>> > >>> I use this parameter to set a member variable in the page's class. > >>> > >>> @OnEvent(component = "parameterType", value = > >> EventConstants.VALUE_CHANGED) > >>>> private Object > pairParameterTypeChanged(ChariotTestTypePairParameterType > >>>> selectedType) { > >>>> this.parameterType = selectedType; > >>>> System.out.println("Type1: " + this.parameterType); > >>>> return this; > >>>> } > >>> > >>> > >>> In another part of the page, I use a Delegate to conditionally display > a > >>> block. > >>> > >>> public Block getPairParameterInputBlock() { > >>>> System.out.println("Type2: " + this.parameterType); > >>>> if (this.parameterType == null) { > >>>> return null; > >>>> } > >>>> switch (this.parameterType) { > >>>> case TEXT: > >>>> return this.textPairParameterInput; > >>>> case NUMERIC: > >>>> return this.numericPairParameterInput; > >>>> default: > >>>> return null; > >>>> } > >>>> } > >>> > >>> > >>> What I'm facing there is that *this.parameterType* is always null and > >> never > >>> sees the value set to it in the Select component's event handler > method ! > >>> > >>> I understand there could be other ways to achieve the same behavior but > >> why > >>> isn't this behaving as I expect ? > >>> > >>> *---------------------* > >>> *Muhammad Gelbana* > >>> http://www.linkedin.com/in/mgelbana > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >