CCALI / a2jauthor

CALI A2JAuthor document automation authoring and viewing platform
https://www.a2jauthor.org
Other
4 stars 1 forks source link

Prevent authors from using date and number variables outside of date and number field types. #396

Open JessicaFrank opened 3 months ago

JessicaFrank commented 3 months ago

Issue https://github.com/CCALI/a2jviewer/issues/272 related to invalid dates and numbers being entered into date and number variable types. Likely the cause is an author using a text field and a date/number variable. Text fields don't restrict user input the way date or number fields do.

We need to throw up a warning if an author adds a date or number variable type to a field type that it shouldn't (text, text long, text pick from list, gender, avatar, radio button, checkbox, checkbox NOTA)

This should be something like "You've added a variable type that does not match the field type you've selected. This can cause issues at assembly if the user inputs invalid information. Consider revising your field or variable type."

This should be similar to the warning we currently pop up if a user attempts to preview a page and hasn't added a variable to a field.

JessicaFrank commented 2 months ago

Edit this to add an author should be prevented from adding a date or number variable type to any field that isn't a date or number field type.

Old interviews opened in A2J Author will warn that there are variable mismatch problems and the author needs to fix them to save. Potentially wipe the mismatches out in reuploaded/existing interviews?

Relates to https://github.com/CCALI/a2jviewer/issues/272 where the "bad" answers will be set to unanswered before the post, so if mismatches persist in the "wild", they will be caught by the A2J Viewer and prevented from breaking HotDocs assemblies.

JessicaFrank commented 2 months ago

CALI need will need to investigate best solution for handling older/existing interviews. Potentially do an interview "healthcheck" that crawls the entire interview to see if there are mismatches, then warns the author every time they try to save their interview file. Mike suggested caching the healthcheck results so only new changes are checked each save to optimize the speed of the check. Team will investigate once the work begins.

JessicaFrank commented 2 months ago

We will create a list of field types and the variable type that is allowed to be used within it. New interviews/new pages will only allow an author to add a variable to a field if it's in the "approved for that field type" list (Ex. Date variable type can't be added to a text -pick from list field type). Older/existing interviews will have the "healthcheck" run on them for this same mismatch check (as mentioned in last comment).

mikemitchel commented 1 month ago

reqs: