how to avoid blank spaces in field value at begining and ending

ramnuka
Kilo Contributor

my question is name field value   contains any blank spaces at beginning and ending form is not submitted.

so please tell me on submit code for that..

Thanks,

Rambabu

8 REPLIES 8

arjungupta
Kilo Contributor

You can write an onChange Client script on the name field to check for any leading or trailing spaces and show an error if it does have one.


You can use the below Code:




var name = " Arjun Gupta ";



var res = name.match(/^\s+|\s+$/i);


  if(res!== null){


      alert("Spaces are not allowed at the begining or ending of the Name")


  }




PS: Hit like, Helpful or Correct depending on the impact of the response


ramnuka
Kilo Contributor

Hi guys,



Thank you guys its working and I have one more doubt that


I want to hide error message when again I enter the submit button.is it possible to any way?



please find the attachment and I won't come like this.




Capture.PNG


In the beginning of the on submit client script , write



g_form.hideFieldMsg('u_name', true); // assuming u_name is the column name




Thanks,


Mihir


Hitesh targe
Tera Expert

g_form.getValue() is giving error in service portal.