样例代码

<script type="text/javascript">
    $(document).ready(function(){
        var mainFormField1 = "field1";
        var fieldId1 = "field1";
        
        var mainFormField2 = "field3";
        var fieldId2 = "field3";
        
        //get value from parent form
        var value1 = $('[name='+mainFormField1+']:enabled', window.parent.document).val();
        var value2 = $('[name='+mainFormField2+']:enabled', window.parent.document).val();
        
        //store the value to a field
        var f1 = FormUtil.getField(fieldId1);
        var f2 = FormUtil.getField(fieldId2);
        
        var f1Value = FormUtil.getValue(fieldId1);
        var f2Value = FormUtil.getValue(fieldId2);
        
        if(f1Value == null || f1Value =='' || f1Value == undefined){
            $(f1).val(value1);
        }
        if(f2Value == null || f2Value =='' || f2Value == undefined){
            $(f2).val(value2);
        }
    });
</script>

样例APP

APP_prob_test-2-20200710142549.jwa


  • No labels