-2

I need a Cognito Forms field that is a year. A person filling out the form enters the year when he/she joined the organization. I need to validate this field by comparing it to the person's birthdate and ensure that the person joined after age 15. I also need to use it to validate that the number of years that person has been a member of a specific chapter of this organization is not more than the total number of years that person was a member of the organization.

The year field can't be a number field because that displays the thousands separator. It can't be a text box because then it can't be used in numeric calculations.

What do you suggest?

0

I'm a developer with Cognito Forms.

While we do not support just a year field. You can set up a Text field to be a year field.

Add a Text field to your form and label it 'Year'. You can then use the drop down option 'Format Validation' to accept only alphanumeric values. While this is not a true year field, it will let users enter in a year, without getting commas.

enter image description here

enter image description here

  • I figured out how to do this. I use a textboox as you suggest. However, my problem was that I needed to use it in a numeric calculation and a textboox's value is a string. So I discovered I could use Int32() to convert it to a number. This is not well documented in your help. – David Apr 27 '17 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.