Need to disable g_modal submit button for the default value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 04:26 AM
Hello! I'm working on a g_modal for a workspace where I have two fields, a choicelist and textarea, in the choicelist, --None-- is the by default value, I need my SUBMIT or OK disabled when None is selected otherwise it should be enabled to submit. Here is the workspace client script, propose a solution for this requirement.
-----------------------------------------------------------------------------------------------------------------------------------
function onClick(g_form) {
var fields = [];
var ga = new GlideAjax('sn_customerservice.GetDynamicChoiceList');
ga.addParam('sysparm_name', 'getFieldChoices');
ga.getXML(callback);
function callback(res) {
var result = res.responseXML.documentElement.getAttribute("answer");
fields.push({
type: 'choice',
name: 'resolution_code',
label: getMessage('Resolution Code'),
value: getMessage(' --None-- '),
choices: JSON.parse(result),
mandatory: true
});
fields.push({
type: 'textarea',
name: 'close_notes',
label: getMessage('Resolution Notes'),
mandatory: true
});
g_modal.showFields({
title: "Closure Information",
fields: fields,
size: 'lg',
height: 280
}).then(function(fieldValues) {
g_form.setValue('resolution_code', fieldValues.updatedFields[0].value);
g_form.setValue('close_notes', fieldValues.updatedFields[1].value);
g_form.setValue('state',6);
g_form.save();
});
}
}
//Thankyou..
0 REPLIES 0