0

i have a jquery file that have :

document.getElementById('formId:someId').click();
bla = document.getElementById('formId:inputId3').value;            
              if(bla =="koko") {
 alert(" Done ");
 }

in jsf i have the method that change the value of the h:inputText :

 <h:inputText id="inputId3" value="#{gestionduplanning.testvalue2}" />

 <h:commandButton id="someId" value="Button" action="#{gestionduplanning.exec2()}" style="display:none">
 <f:ajax render="inputId3" execute="@all"/>  
 </h:commandButton>

and in the managed bean i have :

   public void exec2() {
    this.testvalue2 = "koko";    
   }

the problem i cant enter the if in Jquery because they still have the first default value before the change.

how i can update the update the inputText in the Jquery too be fore the Click on the button ??

marouanoviche
  • 253
  • 4
  • 11
  • 28

1 Answers1

0

Your code should look like this (its the general idea):

document.getElementById('formId:someId').click();

and add the following js function:

function doTheJs(data) {
    if (data.status === 'success') {
        bla = document.getElementById('formId:inputId3').value;            
        if(bla =="koko") {
            alert(" Done ");
        }
    }
}

and your JSF:

<h:commandButton id="someId" value="Button" action="#{gestionduplanning.exec2()}" style="display:none">
    <f:ajax render="inputId3" execute="@all" onevent="doTheJs"/>  
</h:commandButton>
Daniel
  • 36,833
  • 10
  • 119
  • 200