function mySuitelet(request, response)
{
if(request.getMethod() == 'GET')
{
var form = nlapiCreateForm('my form');
form.addField('custpage_radio', 'radio', 'Alpha', 'a');
form.addField('custpage_radio', 'radio','Beta','b');
form.addField('custpage_radio', 'radio','Charlie','c');
form.addField('custpage_radio', 'radio', 'Delta', 'd');
form.getField('custpage_radio', 'a').setMandatory(true);
var machine = form.addSubList('custpage_mysublist', 'inlineeditor', 'my sublist');
var selectField = machine.addField('myselectfield', 'select', 'My Select Field');
selectField.addSelectOption('1', 'One');
selectField.addSelectOption('2', 'Two');
selectField.addSelectOption('3', 'Three');
form.addSubmitButton('submit');
response.writePage(form);
}
else
{
}
}
After that, run/launch the Suitelet. Without making any selection, click Submit. The form would be submitted and no error would be triggered. In order to make the radio button field mandatory, use setDefaultValue instead. See sample below:
function mySuitelet(request, response)
{
if(request.getMethod() == 'GET')
{
var form = nlapiCreateForm('my form');
form.addField('custpage_alphbets', 'radio', 'Alpha', 'a');
form.addField('custpage_alphbets', 'radio','Beta','b');
form.addField('custpage_alphbets', 'radio','Charlie','c');
form.addField('custpage_alphbets', 'radio', 'Delta', 'd');
form.addField('custpage_alphbets', 'radio','Echo','e');
form.addField('custpage_alphbets', 'radio','Foxtrot','f');
form.getField('custpage_alphbets', 'a').setDefaultValue('a'); //instead of setMandatory
var machine = form.addSubList('custpage_mysublist', 'inlineeditor', 'my sublist');
var selectField = machine.addField('myselectfield', 'select', 'My Select Field');
selectField.addSelectOption('1', 'One');
selectField.addSelectOption('2', 'Two');
selectField.addSelectOption('3', 'Three');
form.addSubmitButton('submit');
response.writePage(form);
}
else
{
}
}
Great post, Which you have shared here. This information very important for every person those really interesting in. Enjoy Telugu Romantic Songs at nukeradio.com.
ReplyDelete