So I have a textbox placed for when I ask a user to input their name.
Right now, users are able to enter a word, which is fine, but if they do two words it gives them an error.
I need a way for spaces to be accepted, but only if they come after words.
That way users aren’t able to insert a string consisting only of spaces.
“New Port Richey” should be allowed, but not “⠀⠀”
How would I be able to do this?
This is my code currently:
<<button Confirm>> <<if $name is "">> <<replace "#textbox-error">>Please enter a name.<</replace>> <<elseif /[^A-Z]/i.test($name)>> <<replace "#textbox-error">>Names may only contain letters.<</replace>> <<else>> <<replace "#textbox-error">><</replace>> <<goto "Start.PickSettlementLocation">> <</if>> <</button>> <br/> <span id="textbox-error" style="color:#00FA9A;"></span> <br/>