Reputation: 281
i have 2 buttons on my suitelet form, Standard Submit Button and Client Script button. The submit button does not execute if i have the clientScriptModulePath
in my suitelet code. once i remove the clientScriptModulePath
, the submit button starts working. Anyone have any idea what could be the reason?
Suitelet:
function onRequest(context) {
log.debug('request type', context.request.method);
var form = serverWidget.createForm({ title: 'Item Search' });
if (context.request.method === 'GET') {
var rec_id = context.request.parameters.id;
log.debug('rec id', rec_id)
form.addButton({
id: 'custpage_btn_goback',
label: 'Go Back',
functionName: 'onBackButtonClick'
});
form.clientScriptModulePath = '../client/mx_itemsearch_filter_cs.js';
form.addSubmitButton({
label: 'Submit'
});
context.response.writePage(form);
}
else {
log.debug('POST', 'POST')
}
}
Client script function:
function onBackButtonClick() {//TODO:
try {
console.log('in back button')
var currRec = currentRecord.get();
var suiteletUrl = url.resolveScript({
scriptId: 'customscript_mx_itemsearch_sl',
deploymentId: 'customdeploy_mx_itemsearch_sl'
});
console.log(suiteletUrl)
window.open(suiteletUrl, '_self');
} catch (e) {
log.error({ title: fx, details: 'Error - Code: ' + e.code + ', Message: ' + e.message });
}
}
Upvotes: 0
Views: 2045
Reputation: 2840
You need to add one valid client side endpoint function. The endpoint function can just be a blank function. Example
function pageInit (context) {};
The your client script should have export the client endpoint function and your custom function.
return { pageInit: pageInit, onBackButtonClick: onBackButtonClick};
Upvotes: 2