功能1:在流程表单中,当点击提交按钮时,根据表单中某字段值判断是否要进行表单提交确认

<script type="text/javascript">
$(function() {
    var assignmentComplete = FormUtil.getField("assignmentComplete");
    var validatedFiled = FormUtil.getField("field1");// 需要验证的字段id,这里为“field1”.
    var validatedFiledVal = "Yes";// 需要验证的字段值,这里为“Yes”

    $(assignmentComplete).click(function() {
        var actualValidatedFiledVal = $(validatedFiled).val();

        if (actualValidatedFiledVal == validatedFiledVal) {
            var confirmMessage = "Are you sure?";// 提示信息
            var r = confirm(confirmMessage);
            if (r == true) {
                return true;
            } else {
                setTimeout(function() {
                    $.unblockUI();
                }, 500)
                return false;
            }
        }
    })
})
</script>

功能2:在流程表单中,当点击提交按钮时,根据表单中某字段多个值判断是否要进行表单提交确认

<script type="text/javascript">
$(function() {
    var assignmentComplete = FormUtil.getField("assignmentComplete");
    var validatedFiled = FormUtil.getField("status");// 需要验证的字段id,这里为“field1”.
    var validatedFiledVal1 = "submitted";// 需要验证的字段值,这里为“Yes”
    var validatedFiledVal2 = "cancelled";// 需要验证的字段值,这里为“Yes”
   
    $(assignmentComplete).click(function() {
        var actualValidatedFiledVal = $(validatedFiled).val();
   
        if (actualValidatedFiledVal == validatedFiledVal1) {
            var confirmMessage = "Please confirm your Submit action for this form.";// 提示信息
             
        }else if(actualValidatedFiledVal == validatedFiledVal2){
            var confirmMessage = "Please confirm your Cancel action for this form.";// 提示信息
        }else if(actualValidatedFiledVal == null){
            var confirmMessage = "Please select status.";// 提示信息
        }
        var r = confirm(confirmMessage);
            if (r == true) {
                return true;
            } else {
                setTimeout(function() {
                    $.unblockUI();
                }, 500)
                return false;
            }
    })
})
</script>

功能3:在流程表单中,当点击保存按钮弹出确认提示,当点击提交按钮时根据表单中某字段多个值判断是否要进行表单提交确认

<script type="text/javascript">
$(function() {
    var assignmentComplete = FormUtil.getField("assignmentComplete");
  
    $(assignmentComplete).click(function() {
        var validatedFiled = FormUtil.getField("status");// 需要验证的字段id,这里为“field1”.
        var validatedFiledVal1 = "endorsed";// 需要验证的字段值,这里为“Yes”
        var validatedFiledVal2 = "endorserRejected";// 需要验证的字段值,这里为“Yes”
        var actualValidatedFiledVal = $(validatedFiled).val();
  
        if (actualValidatedFiledVal == validatedFiledVal1) {
            var confirmMessage = "Please confirm your Endorse action for this form.";// 提示信息
            
        }else if(actualValidatedFiledVal == validatedFiledVal2){
            var confirmMessage = "Please confirm your Reject action for this form.";// 提示信息
        }else if(actualValidatedFiledVal == null || actualValidatedFiledVal==""){
            var confirmMessage = "Please select status.";// 提示信息
        }
        var r = confirm(confirmMessage);
            if (r == true) {
                return true;
            } else {
                setTimeout(function() {
                    $.unblockUI();
                }, 500)
                return false;
            }
    });
    $(".form-cell input[type='submit']").click(function(){
        var id = this.id
        var confirmMessage;
        if(id == 'saveAsDraft'){
            var r = confirm('Please confirm your Save action for this form.');
            if(r){
                return r;
            }else{
                setTimeout(function() {
                        $.unblockUI();
                }, 500)
                return false;
            }
        }
    });
});
</script>

功能4:在流程表单中,当点击提交按钮时,根据点击的按钮判断是否要进行表单提交确认

<script type="text/javascript">
$(function() {
    $("#section-actions .form-cell input[type='submit']").click(function(){
        var id = this.id
        var confirmMessage;
        if(id == 'saveAsDraft'){
            confirmMessage = 'Please confirm your SAVE action for this form.'
        }else if(id =='assignmentComplete'){
            confirmMessage = 'Please confirm your SUBMIT action for this form.'
        }
        var r = confirm(confirmMessage);
        if(r){
            return r;
        }else{
            setTimeout(function() {
                    $.unblockUI();
            }, 500)
            return false;
        }
    })
})
</script>




  • No labels