Questions Tagged With ajaxhttps://answers.axonivy.com/tags/ajax/?type=rss&user=anhlequestions tagged <span class="tag">ajax</span>enWed, 11 Dec 2019 23:40:42 -0500How to switch off validation for ajax call?https://answers.axonivy.com/questions/4271/how-to-switch-off-validation-for-ajax-call<p>Hi Ivy Team</p> <p>I have a autocomplete. The autocomplete is required field. In autocomplete. I have ajax to handle change event. When autocomplete changes, some fields will be updated below. But When I clear data from autocomplete. The message required is display and some fields are no more update. So I want to do validation only when a button is clicked which submits the form but not when autocomplete changes. How I can do this?</p> <p>Note: I try using "immediate" attribute in ajax to switch off validation but it is not work.</p> <pre><code>&lt;p:autoComplete id="select-vendor" widgetVar="select-vendor" value="#{purchase.vendor}" dropdown="true" scrollHeight="400" completeMethod="#{tenderInformationBean.completeVendor}" var="vendor" itemLabel="#{vendor.vendorName}" itemValue="#{vendor}" maxlength="50" converter="pojoConverter" cache="true" queryDelay="500" rendered="#{!tenderInformationBean.isVendorNotFound}" binding="#{tenderInformationBean.vendorNameAutoComplete}" disabled="#{isReadOnlySupplier}" forceSelection="true" requiredMessage="#{ivy.cms.co('/ch.ivy.addon.portalkit.ui.jsf/common/requiredFieldMessage')}" &gt; &lt;p:ajax event="change" update="vendor-information-fieldset" global="false" listener="#{tenderInformationBean.onSelectVendorName(purchase)}" onstart="if(PF('select-vendor').panel.is(':visible')) return false;" immediate="true"/&gt; &lt;p:ajax event="itemSelect" update="vendor-information-fieldset" global="false" listener="#{tenderInformationBean.onSelectVendorName(purchase)}" /&gt; &lt;f:validator validatorId="awsValidator" /&gt; &lt;/p:autoComplete&gt; </code></pre> <p>Thanks</p>anhleWed, 11 Dec 2019 23:40:42 -0500https://answers.axonivy.com/questions/4271/how-to-switch-off-validation-for-ajax-calljsfajaxprimefaces