Guru Guru - 1 month ago 13
Javascript Question

How to validation check in Netsuite Suitelet Script

I created form using nlapiCreateForm and add some fields.

Clicking submit button I want to check validation but it entered post mode automatically.

Some fields need to be required field so that null value couldn't be inputed.

Anyone pls help me.

Answer

When you create your field, you can call .setMandatory()

Example:

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