Copy link to clipboard
Copied
Is there a way to remove any initial spaces for a text field. So if user enters: [ Bill] it formats it to: [Bill].
This is for a validation check so the user cannot just enter spaces and is required to enter a name. Maybe a way to check for letters as well.
if (getField("step1.namefield").valueAsString === ""){
( As spaces pass check for this)
Copy link to clipboard
Copied
You should use the "trim()" method: https://www.w3schools.com/jsref/jsref_trim_string.asp
Be careful, PDF-JavaScript (ECMAScript) does not support "let", use "var" instead.