요청 승인 UI 동작을 클라이언트 (클라이언트 확인란)에서 실행하도록 설정하고 Onclick 필드를 requestApproval()로 설정할 수 있습니다. 스크립트 본문에 대한 지침으로 다음 코드를 사용하십시오. 이렇게하면 UI 액션이 두 단계로 실행됩니다. 클라이언트에서 유효성 검사 논리를 작성할 수있는 곳과 유효성 검사 논리가 성공한 경우 서버에서 (gsftSubmit에 의해 트리거 됨).
기본적으로 시스템에 이러한 종류의 코드를 사용하는 몇 가지 UI 작업이 있습니다. "스크립트에 gsftSubmit이 포함 된"UI 액션을 검색하여 다른 예제를 확인하십시오.
function requestApproval(){
// Do your client side validation here
if (g_form.getValue('comments') == '') {
return false; //Abort submission if your validation fails
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'request_approval');
// MUST call the 'Action name' set in this UI Action.
// Make sure this name doesn't conflict with an existing
// UI Action if this is a custom action.
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
serverResolve();
function serverResolve(){
change_request.state = 1;
// other server side actions you wish to take
}
이것은 효과가 있습니다. 감사합니다. – user2475677