-
gemaiAsked on October 22, 2015 at 10:17 PM
Hi there
To ensure data quality, I'd like to add a few validations in my form. For example, I have a text field and I want it to be filled in a particular format (i.e. EMP99). So, if the user types '67' instead of 'EMP67', I want a message saying: 'The format of this fields should be EMP99'. Is it possible such a thing?
Cheers
Gema
-
SammyReplied on October 23, 2015 at 5:49 AM
Hi Gema,
At the moment it is not possible to customize warning message for each individual form field.
You can however use an input mask to enforce the required format, you can create the mask in such a way the word EMP is already pre-filled and what the user needs to do is just enter the number.
User a normal text box and then set the input mask, you can then turn on the mask validation to ensure only a number is entered.
Here is a preview of the outcome.
-
gemaiReplied on October 28, 2015 at 8:41 PM
Hi Sammy
I've tried what you suggested. My input mask is EMP-***. All good in the data entry but when I go to the Google sheet, I see things like EMP-1__, EMP-78_, EMP-987. Obviously, the last one is perfect but the other two should be EMP-1 and EMP-78.
Thoughts?
-
SammyReplied on October 29, 2015 at 1:54 AM
Hi Gema,
It appears the normal text-field with the mask pattern will pas the (_) when the entire mask field is not filled in.
You can use the masked input widget which will not append the line when you submit single value digits.
Set it up as outlined in the screenshots below.
Scroll down to the bottom to access the following options.
Upon submission the data will be as follows
Please let us know if this addresses your situation.
-
gemaiReplied on November 2, 2015 at 5:55 PM
Hi Sammy
Thanks for your suggestion. I've just tried the Masked Input widget and, although it solves my problem, it creates another one: a space between my prefix (i.e. EMP) and the number. Is there any way of getting rid of the space?
Cheers
Gema
-
SammyReplied on November 3, 2015 at 1:00 AM
Hello Gema,
Unfortunately it seems the space is a default for the mask widget.
We can however use form conditions to achieve the same, here's the approach.
1. create a text-field to take the three digit numbers only
2. Use conditions to update a second field with the text and suffix added.
Click on add field to specify the whose value you want prefixed to the name EMP-
Here is the final outcome
-
gemaiReplied on November 3, 2015 at 4:57 PM
Thanks Sammie. That will work.