Skip to content

Commit 540163a

Browse files
authored
Update block_submit.js
Added a validation to verify that 'someVariable' value is not null , so that the Block functionality works smoothly
1 parent 75524d3 commit 540163a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Client-Side Components/Catalog Client Script/Block Submit/block_submit.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
//Block the user from submitting the form based on variable answer
22
function onSubmit() {
3-
var someVariable = g_form.getValue("someVariable");
4-
if(someVariable == 'No'){
3+
var VariableName = 'someVariable';
4+
var VariableVal = g_form.getValue(VariableName);
5+
// Basic validation
6+
if (!VariableVal) {
7+
g_form.showFieldMsg(VariableName, 'Please answer this question before submitting.', 'error');
8+
return false;
9+
}
10+
if(VariableVal == 'No'){
511
var gm = new GlideModal('glide_warn',false);
612
gm.setTitle("Submit Blocked! You can only use this form for someReason. Review someInstructions");
713
gm.render();

0 commit comments

Comments
 (0)