Data fields allow invalid inputs on the API side

  • Profile Image
    ivanokk
    Asked on December 13, 2016 at 07:51 AM

    Hi,

    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?

     

     

  • Profile Image
    owen
    Answered on December 13, 2016 at 08:39 AM

    Hi, 

    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. 

  • Profile Image
    ivanokk
    Answered on December 19, 2016 at 07:57 AM

    Hi,

    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.

    Thanks

  • Profile Image
    candy
    Answered on December 19, 2016 at 08:52 AM

    Hello,

    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.

    Regards.