-
1. Re: How to make ajax call from inside of a4j:support?
ilya_shaikovsky Mar 4, 2010 5:22 AM (in response to maran001.nilay)do not nest support to h:command's to send ajax requests. It will cause two concurent requests to be sent. Use just a4j:command. -
2. Re: How to make ajax call from inside of a4j:support?
maran001.nilay Mar 4, 2010 9:08 AM (in response to ilya_shaikovsky)I tried with replacing h:commandButton to a4j:commandButton, but the problem is, it is not calling the desired method.
Please guide me with an example to achieve that.
-
3. Re: How to make ajax call from inside of a4j:support?
maran001.nilay Mar 4, 2010 9:41 AM (in response to ilya_shaikovsky)Here just an example which is not working:
<h:form id="myform">
<a4j:queue/>
<h:panelGrid columns="2">
<h:selectOneRadio id="yes_no" value="#{generalInfoService.answer}" immediate="true" valueChangeListener="#{generalInfoService.answerClicked}">
<f:selectItem id="app1" styleClass="label" itemLabel="Yes" itemValue="Yes" />
<f:selectItem id="app2" styleClass="label" itemLabel="No" itemValue="No" />
<a4j:support event="onclick" reRender="savecancel" action="#{generalInfoService.save}" requestDelay="100"/>
</h:selectOneRadio>
</h:panelGrid>
</h:form>
<a4j:outputPanel id="savecancel">
<a4j:commandButton type="submit" value="SAVE" action="#{generalInfoService.save}"/>
<rich:spacer width="4" height="0" />
<a4j:commandButton type="submit" value="CANCEL" action="#{generalInfoService.cancel}"/>
</<a4j:outputPanel>while clicking on save/ cancel the desired function is not fired. Don't know what's the problem...
-
4. Re: How to make ajax call from inside of a4j:support?
alash2k Mar 4, 2010 11:04 AM (in response to maran001.nilay)Move the a4j output panel within h:form and see if it works. -
5. Re: How to make ajax call from inside of a4j:support?
maran001.nilay Mar 4, 2010 11:07 AM (in response to alash2k)I tried but still now luck...
need more help...
-
6. Re: How to make ajax call from inside of a4j:support?
alash2k Mar 4, 2010 11:13 AM (in response to maran001.nilay)I have something like this.. and it works..
<a4j:commandButton action="#{ReminderController.filter}"
value="#{reminder.filter}" reRender="pickassociates"></a4j:commandButton>
BTW, what is the type="submit" in the tag that you have used? I dont see in documentation.. am I looking at wrong place?
-
7. Re: How to make ajax call from inside of a4j:support?
maran001.nilay Mar 4, 2010 11:29 AM (in response to alash2k)<h:form>
<a4j:outputPanel id="op_tipoConsulta">
<h:selectOneRadio value="#{generalInfoService.answer}" valueChangeListener="#{generalInfoService.answerClicked}">
<f:selectItem itemLabel="Caixa" itemValue="Yes"/>
<f:selectItem itemLabel="Formulario" itemValue="No"/>
<a4j:support event="onclick" reRender="op_tipoFormulario" />
</h:selectOneRadio>
</a4j:outputPanel>
<a4j:outputPanel id="op_tipoFormulario">
<s:fragment rendered="#{not empty generalInfoService.answer and generalInfoService.answer != 'No'}">
<h:selectManyCheckbox value="#{generalInfoService.answer1}" valueChangeListener="#{generalInfoService.saveCancel}">
<f:selectItem itemLabel="Test 1" itemValue="Yes"/>
<f:selectItem itemLabel="Test 2" itemValue="No"/>
<a4j:support event="onclick" reRender="op_tipoConsultaCaixa"/>
</h:selectManyCheckbox>
</s:fragment>
</a4j:outputPanel>
<a4j:outputPanel id="op_tipoConsultaCaixa">
<s:fragment rendered="#{generalInfoService.answer != 'No'}">
Yahhooo
</s:fragment>
</a4j:outputPanel>
</h:form>Please look at the code above:
1. For first call to generalInfoService.answerClicked, it works properly
2. For second call to generalInfoService.saveCancel, it doesn't work
Let me know if i ma doing something wrong here...
-
8. Re: How to make ajax call from inside of a4j:support?
ilya_shaikovsky Mar 5, 2010 5:37 AM (in response to maran001.nilay)1) command controls has to be encosed with form.
2) add rich:messages to the page.
-
9. Re: How to make ajax call from inside of a4j:support?
maran001.nilay Mar 5, 2010 9:16 AM (in response to ilya_shaikovsky)Please look at this sample and try to understand my problem.
I think i am not able to communicate my problem properly..
<h:form>
<a4j:outputPanel id="op_tipoConsulta">
<h:selectOneRadio value="#{generalInfoService.answer}" valueChangeListener="#{generalInfoService.answerClicked}">
<f:selectItem itemLabel="Caixa" itemValue="Yes"/>
<f:selectItem itemLabel="Formulario" itemValue="No"/>
<a4j:support event="onclick" reRender="op_tipoFormulario" />
</h:selectOneRadio>
</a4j:outputPanel>
<a4j:outputPanel id="op_tipoFormulario">
<s:fragment rendered="#{not empty generalInfoService.answer and generalInfoService.answer != 'No'}">
<h:selectManyCheckbox value="#{generalInfoService.answer1}" valueChangeListener="#{generalInfoService.saveCancel}">
<f:selectItem itemLabel="Test 1" itemValue="Yes"/>
<f:selectItem itemLabel="Test 2" itemValue="No"/>
<a4j:support event="onclick" reRender="op_tipoConsultaCaixa"/>
</h:selectManyCheckbox>
</s:fragment>
</a4j:outputPanel>
<a4j:outputPanel id="op_tipoConsultaCaixa">
<s:fragment rendered="#{generalInfoService.answer != 'No'}">
Yahhooo
</s:fragment>
</a4j:outputPanel>
</h:form>Please look at the code above:
1. For first call to generalInfoService.answerClicked, it works properly
2. For second call to generalInfoService.saveCancel, it doesn't work
Let me know if i am doing something wrong here...