2013-05-29 2 views
0

에서 업데이트 된 값을 얻을 수 있습니다 :은 내가 어떻게해야 JQuery와 파일이 자바 스크립트

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

내가 시간의 값을 변경하는 방법이 있습니다 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> 

및 관리 빈에 내가있다 :

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

문제가 STI 때문에 내가 JQuery와의 if를 입력 캔트 변경 전 첫 번째 기본값이 있습니다.

업데이트 방법은 Jquery의 inputText도 업데이트 할 수 있습니까?

+0

비트를 당신은 jQuery를 순수 JavaScript라고 부르고있다. jQuery를 전혀 사용하지 않는 것 같아서 태그를 제거했습니다. –

+0

제목도 업데이트합니다. – marouanoviche

+1

@marouanoviche,이게 도움이 될까요? http://stackoverflow.com/a/16444123/617373 – Daniel

답변

0

귀하의 코드는 (그것의 일반적인 생각)과 같아야합니다

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

다음과 같은 JS 기능 추가 :

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

와 JSF :

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