- gemaiAsked on October 22, 2015 at 10:17 PM
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?
- SammyAnswered on October 23, 2015 at 05:49 AM
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.
- gemaiAnswered on October 28, 2015 at 08:41 PM
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.
- SammyAnswered on October 29, 2015 at 01:54 AM
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.
- gemaiAnswered on November 02, 2015 at 05:55 PM
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?
- SammyAnswered on November 03, 2015 at 01:00 AM
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
- gemaiAnswered on November 03, 2015 at 04:57 PM
Thanks Sammie. That will work.