What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
Data fields allow invalid inputs on the API sideAsked by ivanokk on December 13, 2016 at 07:51 AM
data fields allow extra spaces input as visible in the attached screenshot taken from Jotform API.
I expected to have a "day" of 2 digits, a "month" of 2 digits and a "year" of 4 digits, as well as a "prettyFormat" of 10 digits.
How can I solve this problem?
This should be caused by the entry of your user who made that particular submission. We have created a test form with a DateTime field. We ran 2 test submissions one with a normal entry (I mean we just picked a date and did not touch the field itself after it) and one with a spaced entry. (This means, we picked a date, then we intentionally put spaces after the selection. Please see its screenshot here:
Please see the difference between them:
This is the one with the normal entry when an API call is made on api.jotform.com:
However, please see how that spaced entry looks:
It's the same look that you have reported. Of course we can make those spaces be trimmed on the back-end. However, this may cause other problems. So, I'm afraid you should trim the spaces manually.
Please contact us again if you need any further assistance.
sorry my late reply. I don't understand your reference to "other problems" may cause if the validate of the input date is made by Jotform. There is only a good effect, that is to be sure to have a valid date input like MM-GG-YYYY.
I also saw that data field accept everything in input (i.e.: a year with 5 digits like "19751") and this is a big problem.
Here https://www.jotform.com/answers/630808-Year-in-Date-Field-gone-astray an input of 5 digit in the year field is judged strange and not acceptable.
I think a date field must accept only valid dates in input, otherwise it is not a date field.
Thank you for reporting the issues.
I have forwarded this issues to our software development team in order to consider implementing this controls on the API side. They are going to check and you are going to be informed via this thread.
If you have any question, do not hesitate to contact us.