如何在 Netsuite Suitelet 脚本中验证检查

How to validation check in Netsuite Suitelet Script

我使用 nlapiCreateForm 创建了表单并添加了一些字段。

单击提交按钮我想检查验证,但它自动进入了 post 模式。

有些字段需要为必填字段,这样就无法输入空值。

任何人都可以帮助我。

创建字段时,可以调用.setMandatory()

示例:

var form = nlapiCreateForm('Test Form');
var field = form.addField('custpage_testfield','text','Test Field');
field.setMandatory(true);

对于所有客户端验证,您可以为动态表单创建一个新的客户端验证脚本。

然后调用

form.setScript('id of your client side script goes here');