The CreatorCon Call for Content is officially open! Get started here.

on submit client script is not working

chandan2212
Tera Contributor

Hi All, 

 

onsubmit client script is not working 

function onSubmit() {
  var gr = g_form.getValue('action');
  
  if (gr === 'sharing') {
    alert('Chandan Patra');
    return false; // Prevents form submission
  }

  return true; // Allows form submission
}

 Thanks and Regards,

Chandan 

3 REPLIES 3

RaghavSh
Kilo Patron

Avoid using gr as variable.

 

what is action here, is it a field name?

 

Remove return=true; there is no need for that statement.


Raghav
MVP 2023
LinkedIn

@chandan2212 Did this work for you?


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn

Ankur Bawiskar
Tera Patron
Tera Patron

@chandan2212 

are you comparing correct value for action in your IF

💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader