File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Client-Side Components/Catalog Client Script/Onsubmit validation Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ function onSubmit() {
2+
3+
4+ var hardware = g_form.getValue('hardware_name');
5+ var qty = g_form.getValue('quantity');
6+
7+
8+
9+ var ga = new GlideAjax('HardwareValidationUtils');
10+ ga.addParam('sysparm_name', 'validateHardware');
11+ ga.addParam('sysparm_hardware', hardware);
12+ ga.addParam('sysparm_quantity', qty);
13+
14+
15+ ga.getXMLAnswer(function(response) {
16+
17+
18+ if (response !== 'OK') {
19+ alert(response);
20+
21+ g_form.addErrorMessage(response); // Optional inline error
22+ g_form.setSubmit(false); // Prevent submission in Service Portal
23+ } else {
24+
25+ g_form.setSubmit(true); // Allow submission
26+ }
27+ });
28+
29+ return false;
30+ }
You can’t perform that action at this time.
0 commit comments