To hide a field in a Suitelet form in NetSuite while ensuring its value is submitted, create the form and add the necessary fields using serverWidget. For the field to hide, use the updateDisplayType method to set its display type to HIDDEN, and assign a default value if needed. When the form is displayed to the user, the hidden field will not be visible, but its value will still be included in the form submission. Upon submission, we can access and process the hidden field’s value from the request parameters. This approach is useful for including internal data or default values that should not be altered by the user.
Here is an example:
var form = serverWidget.createForm({
title : 'Simple Form'
});
var field = form.addField({
id : 'custpage_text',
type : serverWidget.FieldType.TEXT,
label : 'Text'
});
field.updateDisplayType({
displayType: serverWidget.FieldDisplayType.HIDDEN
});