Ontonomo
Ontonomo

Reputation: 557

can a4j:support have more than one value in the event attribute?

can a4j:support have more than one value in the event attribute?

<a:support event="onchange, onsubmit" ajaxSingle="true"
action="#{customerSession.userCheckQuantity(_cartItem, index)}"
reRender="shoppingCartAjax, orderTotalAjax"></a:support>

Upvotes: 3

Views: 8526

Answers (2)

Ramin Mir.
Ramin Mir.

Reputation: 784

You can use actionparam for this, here is an example:

< a4j:commandButton ajaxSingle="true" value="Clean Up Form" reRender="name, job, out"  status="commonstatus">

                <a4j:actionparam name="n" value=""  assignTo="#{userBean.name}" />

                <a4j:actionparam name="j" value=""  assignTo="#{userBean.job}" />

< /a4j:commandButton>

similar for a4j:support

Upvotes: 0

dertkw
dertkw

Reputation: 7838

No, you can't. In the TLD for the event attribute it says:

Name of JavaScript event property ( onclick, onchange, etc.) of parent component, for which we will build AJAX submission code

There has been a JIRA requesting this feature, but it's still open. Since it's for RF3, I'm guessing this won't change.

However there is another request for a4j:ajax (equivalent in RF4) supporting the same thing. Since it's for RF4, I'm guessing it's more likely to get implemented.

As an alternative, you can just use multiple a4j:support tags for one compoent:

<h:selectOneMenu id="planets" value="#{planetsMoons.currentPlanet}" valueChangeListener="#{planetsMoons.planetChanged}">
    <f:selectItems value="#{planetsMoons.planetsList}" />
    <a4j:support event="onchange" reRender="id1,id2" />
    <a4j:support event="onkeyup" reRender="id1,id3" />
</h:selectOneMenu>

Upvotes: 4

Related Questions