-
1. Re: Anybody else experience a4j:support *not* calling action
christian.bauer Apr 4, 2007 4:44 PM (in response to gzoller)What I was falling over a lot was that the reRender attribute really has to name a component that is _always_ rendered. So no or <s:div id="foo" rendered="sometimes">. Only <s:div id="foo"> works.
-
2. Re: Anybody else experience a4j:support *not* calling action
christian.bauer Apr 4, 2007 4:44 PM (in response to gzoller)It might or might not have something to do with your issue but give it a shot. I still find it hard to debug what is going on.
-
3. Re: Anybody else experience a4j:support *not* calling action
gzoller Apr 4, 2007 5:05 PM (in response to gzoller)Ok, this might be a bug...
Everything on the page was always rendered, so that wasn't it. By process of elimination I identified the code causing the problem.
This worked: (action method app.setTimecardWorker was called when item changed)<h:outputLabel styleClass="textLabel2" for="worker">Worker</h:outputLabel> <s:decorate> <h:selectOneMenu id="worker" value="#{timecardHome.instance.workerName}"> <f:selectItems value="#{app.activeWorkers}" /> <a4j:support event="onchange" action="#{app.setTimecardWorker(timecardHome.instance)}" reRender="rate" ajaxSingle="true"/> </h:selectOneMenu> </s:decorate> <h:outputLabel styleclass="textLabel2" for="rate">Rate $</h:outputLabel> <s:decorate> <h:inputText id="rate" required="true" size="3" value="#{timecardHome.instance.hourlyRate}"/> </s:decorate> <h:outputLabel styleClass="textLabel2" for="hours">Hours</h:outputLabel> <s:decorate> <h:inputText id="hours" required="true" size="3" value="#{timecardHome.instance.hours}"/> </s:decorate> <h:outputLabel styleclass="textLabel2" for="description">Description</h:outputLabel> <s:decorate> <h:inputText id="description" required="true" size="40" value="#{timecardHome.instance.description}"/> </s:decorate>
This didn't (no action method was called when same item was changed)<h:outputLabel styleClass="textLabel2" for="worker">Worker</h:outputLabel> <s:decorate> <h:selectOneMenu id="worker" value="#{timecardHome.instance.workerName}"> <f:selectItems value="#{app.activeWorkers}" /> <a:support event="onchange" action="#{app.setTimecardWorker(timecardHome.instance)}" reRender="rate" ajaxSingle="true"/> </h:selectOneMenu> </s:decorate> <h:outputLabel styleclass="textLabel2" for="rate">Rate $</h:outputLabel> <s:decorate> <h:inputText id="rate" required="true" size="3" value="#{timecardHome.instance.hourlyRate}"/> </s:decorate> <h:outputLabel styleClass="textLabel2" for="month">Month</h:outputLabel> <s:decorate> <h:selectOneMenu id="month" converter="#{monthconverter}" value="#{timecardHome.instance.month}"> <f:selectItems value="#{app.months}" /> </h:selectOneMenu> </s:decorate> <h:outputLabel styleClass="textLabel2" for="hours">Hours</h:outputLabel> <s:decorate> <h:inputText id="hours" required="true" size="3" value="#{timecardHome.instance.hours}"/> </s:decorate> <h:outputLabel styleclass="textLabel2" for="description">Description</h:outputLabel> <s:decorate> <h:inputText id="description" required="true" size="40" value="#{timecardHome.instance.description}"/> </s:decorate>
It seems adding the second select list did something to interfere with a4j:support calling the action method on the first select list. Bizarre!
Any clues?
Greg -
4. Re: Anybody else experience a4j:support *not* calling action
christian.bauer Apr 5, 2007 12:47 AM (in response to gzoller)Might want to ask in the ajax4jsf forum.
-
5. Re: Anybody else experience a4j:support *not* calling action
sergeysmirnov Apr 5, 2007 12:54 AM (in response to gzoller)I guess, if you add:
<a4j:outputPanel ajaxRendered="true"> <h:messages /> </a4j:outputPanel>
you can why the action is not invoked.
Instead of using ajaxSingle="true" surround s:decorate with <a4j:region> -
6. Re: Anybody else experience a4j:support *not* calling action
gzoller Apr 5, 2007 10:19 AM (in response to gzoller)Thanks Sergey!
The <a4j:region> did the trick. The <a4j:outputPanel> is quite handy! Haven't used that before. When I added that it revealed an exception trying to set a null value to the month pulldown. It really shouldn't have been trying to do anything with the month field, so using the region "focused" a4j into doing what I wanted.
Thanks again!
Greg