1

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.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Nishant Varshney
  • 685
  • 2
  • 14
  • 34
  • 1
    Possible duplicate of [How can I know the id of a JSF component so I can use in Javascript](https://stackoverflow.com/questions/6045307/how-can-i-know-the-id-of-a-jsf-component-so-i-can-use-in-javascript) – Kukeltje May 11 '18 at 12:17

0 Answers0