如何使子列表字段成为必填字段?

戴维娜

这是我的 pageInit 函数

function poTransPageInit(type) {
    //   alert('page init');
    var field= nlapiGetLineItemField('item', 'field');
    field.isMandatory = true;
}

我在这里做错了什么?

玛莎

isMandatory 方法在客户端脚本中确实不可用。作为解决方法,您可以获取字段的值并检查长度。

function validateLine(type){
  if(type == 'sublistInternalID'){ //sublistInternalID = sublist internal id, i.e. 'item'
    //get the sublist field value of mandatory column
    var name = nlapiGetCurrentLineItemValue('line', 'fieldId'); //line = line #, fieldId = internal id of field
    //if value length is greater than 0, then there is a value
    if(name.length > 0){
      return true;
    } else {
      alert('Please enter a value for Name field');
      return false;
    }
  }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章