Field validation for blank spaces

  • 28 June 2018
  • 4 replies
  • 223 views

Badge +2

Hello all, I've got a smart form with a view that has fields for an email: date, subject, and verbiage.  I've got validation on the smartform that prevents null entries on all of these fields, and it is working properly.  However, a user still can enter a blank space in the subject and verbiage fields and this is accepted by the workflow.

 

I've tried setting the validation on the fields to alphanumeric (no spaces), alphanumeric (with spaces), but that hasn't worked.  I've also set up an advanced rule that checks if the subject or verbiage fields start with a " " value but that doesn't let any entry proceed, even a valid one.

 

Any ideas or suggestions on how I can get this validation to prevent a user from putting a space into either field?


11237iE9D0513F8BC270FF.png


4 replies

Badge +4

Hi Paul,

 

Use trim function to remove leading and trailing blank spaces,For your reference

 

 

 

Thanks,

Vijay

Badge +4

Hi Paul,

 

please let me know if this worked or you want me to explain in more detail.

 

Thanks,

Vijay

Badge +2

Thanks for your response, Vijay.  I wasn't successful with the suggestion.  Here's what I did:

 

1) On the field, I created an expression called Trim that used the trim function you described.

2) I tried running the form but it still was letting me enter a blank space

 

I see on your screenshots it looks like you're setting this up through the rules.  I'm not seeing expressions as an option for me on the rules screen, perhaps I'm looking in the wrong place?  Please provide more details.  Thank you!

Badge +4

Hi Paul,

 

step 1: create an expression that trims white spaces in a textbox (Imp: don't bound this expression to any control)

step 2: in button submit, use transfer data action to transfer the expression into a textbox

step 3: use view/form passes validation to check required fields

step 4: save your textbox values to workflow/database

 

in the above process, it will still allow you to enter empty spaces into a textbox, but step 2 will trims out trailing and leading empty spaces of the text you entered and transfer to a textbox.

 

Example 1: the user enters '     ' into textbox1 and clicks submit. now step 2 changes that into ''.that means textbox1 is empty and it fails in step 3 (require field validation)

 

Example 2: the user enters '  testing data   '  into textbox1 and clicks submit. now step 2 changes that into 'testing data'.Now, step3 passes validation and move to step 4.

 

Thanks,

Vijay

 

 

Reply