문제점 : Visualforce 페이지에 apex : commandButton이 있고 로직이있는 js 파일이 있습니다. 현재이 논리는 css를 사용하여 페이지에서 버튼이 표시되는지 또는 보이지 않는지에 영향을줍니다. 이 단추를 사용하거나 사용하지 않도록 변경해야합니다. 그러나 js 파일에서 버튼을 비활성화하려고 할 때마다 화면 버튼이 영향을받지 않습니다. 나는 프런트 엔드 dev에 경험이 없기 때문에 분명한 것을 놓치거나 오해 할 수있다. .page 파일에자바 스크립트로 활성화/비활성화 버튼
버튼 :
<apex:commandButton id="commitButton"
action="{!commitSelectedLines}"
value="{!$Label.commitSelectedLines}"/>
의 .js 파일 (무겁게 보이는 관련 비트 아래로 편집) :
FFDCBalancer = (function(){
/**
* Singleton Balancer object to maintain balances on the page.
*/
var balancer = {
/** JQuery button component for the commit button. */
cmdCommit: undefined,
/** Set the enabled-ness of the commit button. */
setCommitEnabled : function(value) {
//I PRESUMABLY NEED TO CHANGE THIS BIT TO USE 'DISABLED'.
this.cmdCommit.css({
'display': value ? 'block' : 'none'
});
//I HAVE TRIED VARIOUS BITS OF CODE, SUCH AS THIS
//this.cmdCommit.disabled = value;
},
/**
* Respond to refresh by connecting event handlers and calculating the balances.
*/
onRefresh : function() {
var me = this;
me.cmdCommit = $FFDC('#commitButton');
}
};
$FFDC(document).on('FFDCRefresh', function(){ balancer.onRefresh(); });
return balancer;
}());
게시물에 실제 HTML 출력을 포함해야 할 수도 있습니다. 이것은 서버 측 코드를 다음과 같습니다 <정점 : 명령 단추 ID = "commitButton" 행동 = "{commitSelectedLines!}" 값 = "{$ Label.commitSelectedLines!}"/> 나는 HTML 페이지를 얻기 위해 크롬을 사용 –
. 그것의 방대한,하지만 나는 이것을 찾았습니다 - "p1 : f1 : pb1 : j_id10 : commitButton"type = "제출"name = "p1 : f1 : pb1 : j_id10 : commitButton"value = "Commit Selected Lines"class = "btn"> –
이 기능은 어떻게 작동합니까? '$ FFDC ('# commitButton')'. jQuery와 같은 sizzle을 사용하는 경우 VF가 설정 한 항목에 추가 ID를 추가한다는 것을 기억하십시오. 즉, commitButton은 최종 ID가 아닙니다. jQuery를 사용하여 VF 구성 요소를 검색하는 한 가지 방법은 바로 가기가있는 끝과 함께 원시 ID 특성을 사용하는 것입니다. '$ FFDC (': submit [id $ = ": commitButton"]')'처럼. 이렇게하면 id가 ": commitButton"으로 끝나는 모든 입력 유형을 찾을 수 있습니다. – ScottW