Open ParamConstructor opened 1 week ago
Behavior of required fields (either native ones or configured in Settings) must be the same in forms.
Behavior of required fields (either native ones or configured in Settings) must be the same in forms.
@Jipegien yes it should be consistent, but what is the expected behavior we want?
Expected Output Maliciousness, Author, and Markings should be flagged and visually updated, since the form seems to be flagging required fields and doing an auto validation once the first field is interacted with.
In my opinion a field should be highlighted in red only if : it has been touched or the user has tried to submit the form (as describe in https://github.com/OpenCTI-Platform/opencti/issues/5741). Otherwise we are displaying errors on fields the user doesn't have manipulate yet and I feel this frustrating
@lndrtrbn - Discussed in a meeting on June 20th. There is a PR (https://github.com/OpenCTI-Platform/opencti/pull/7437) which will make behavior consistent to flag all fields red, since that is what all forms currently attempt to do. Then, there is a PR (https://github.com/OpenCTI-Platform/opencti/pull/6972) which will add "*"s (star to label) to denote field is required. Only fields touched and in error will immediately turn red (your preference above). All fields required fields with then only error on submission, if not touched by the user and required.
Ah okok we are on the same page then 😊 after the second PR we will have this behavior, thanks for the info!
Environment
Reproducible Steps
Steps to create the smallest reproducible scenario:
Description / Discussion
Maliciousness, Author, and Markings are not flagged (they get flagged (by formik in the errors array) but only visually updated upon submission or if you manually interact with them). Formik does detect that they are not currently valid, but are only redrawn if they are "meta.touched" due to a change in AutoCompleteField that was submitted with the following historical issue (https://github.com/OpenCTI-Platform/opencti/issues/5741)
Should the form behavior be changed to be set to something like: validateOnChange={false} validateOnBlur={false}
Then, validation only occurs on fields you have touched or upon submission for these custom fields - is this the intended behavior? Or should the "meta.touched" be removed from line 84/85 of opencti-platform/opencti-front/src/components/AutocompleteField.jsx?
Expected Output
Maliciousness, Author, and Markings should be flagged and visually updated, since the form seems to be flagging required fields and doing an auto validation once the first field is interacted with.
Actual Output
Maliciousness, Author, and Markings are not flagged (they get flagged (by formik in the errors array) but only visually updated upon submission or if you manually interact with them). Formik does detect that they are not currently valid, but are only redrawn if they are "meta.touched" due to a change in AutoCompleteField that was submitted with the following historical issue (https://github.com/OpenCTI-Platform/opencti/issues/5741)
Additional information
This behavior was discovered while working this PR (https://github.com/OpenCTI-Platform/opencti/pull/6972) which actually adds "*"'s to the required fields so user can see what is required visually without error messages / ahead of time.
But submitting it as a Bug / Form Behavior Issue related to these custom type fields that rely on AutoCompleteField - to get a determination on the expect behavior.