Objective: I need to check that is there any change in the field of form which is inside a tab.
Approach: I will call a Jquery method on value change of input field and update the value of hidden field inside a perticular collipsable.
Challenge: I am facing a challenge in getting the id of that hidden field and the id of collipsable in which form change is occurring.
sample code:
XHTML
<p:accordionPanel id="FacilityAccordId" activeIndex="null"
dynamic="true">
<p:ajax event="tabChange" listener="#{facilities.saveClicked}" />
<p:tab id="priortabId" title="Prior Sanction/Review Info">
<p:panel id="priorPanelId" header="Prior Sanction/Review Info">
<h:inputHidden id="reviewHidden" value="#{facilities.hiddenReview}"></h:inputHidden>
<p:inputText value="#{facilities.sanctAuth }" styleClass="textbox" id="psrSanctAID" />
<label><h:outputText value="Sanction Authority" /> </label>
</p:panel>
</p:tab>
</p:accordionPanel>
JQUERY:
$(document).ready(function() {
// alert('mkm');
jQuery(document.body).on('change', 'input', function(event) {
// alert('chnage called12');
//var active = $('.selector').accordion('option', 'active');
// alert("value::::"+active);
var data=$('#reviewHidden').val();
$('#reviewHidden').val('true');
});
});
Please help in achieving the objective also suggest if any approach you are having for auto save in Primefaces.