Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

How to detect invalid input in a!dateField to disable a save button?

Certified Associate Developer

Hi Appian community,

I've been dealing with a tricky validation problem with a!dateField and I wanted to share it here in case anyone has found a workaround.

I have a form with several date fields that toggle between a!dateField (edit mode) and a!textField (read mode) based on a modify button that switches readOnly.Switching between these modes is done using a button in a separate rule; within that rule, I also have the option to save the data or exit edit mode. Once you enter edit mode, these two buttons appear. The save button is enabled or disabled based on the field validations.

When the user enters a future date, I can catch it with a custom validation rule and disable the save button without issues.

When the user types something completely invalid like "asdasdh" or "123abc" into the a!dateField, the native component validation fires correctly and shows the error message on the field — but Appian discards the value and stores null in the backing variable. Since null is also a valid state for my fields (the user may or may not fill them out), I have no way to distinguish between "field is empty" and "field has invalid input" to conditionally disable the save button.

the value "asdasdas" is saved as null in ri!valorReal.fechaPaso

I've tried to access the value of “123asbd” using `typeof()`, but the value of a valid date and any input are the same. I also tried to remove the letters using `regexreplaceall()`, but since the value stored by Appian is null, I can't access those values to validate them using `regexreplaceall()`.

The easy solution is to disallow null values, but that would break the functionality I need to implement, which allows the user to enter null values and displays a “-” as the default value in the text field.

Has anyone found a reliable way to detect invalid input specifically in a!dateField while still allowing null values, without replacing it with a a!textField (which loses the calendar picker)?

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data