Expected behavior: Returning false for “beforeChange” event on dhx.Form would prevent changing the value of form fields.
In version 9.0.2, I discovered that the expected behavior did not work for form fields of type “input”, though it seemed to work for other field types. (Specifically tested “textarea” and “select” types.)
I tried version 9.2, and found that the expected behavior still worked for “select” fields, but did not work for either “input” or “textarea” fields.
Just discovered another undesirable behavior in version 9.0.2:
I have the beforeChange event returning a conditional statement for my form. If the value of a textarea is altered while the condition is false, the original text is restored in the field when the field loses focus, as expected. But if the condition is then changed to true, when the field gets focus and then loses focus without typing anything, the changed value that was removed while the condition was false is set as the new value of field when the condition was false. I would expect that the value set while the condition was false would be abandoned entirely.
Example steps:
- Textarea field has value “Baseline” (or is blank)
- beforeChange condition set to return false
- Type “Changed value” into Textarea field.
- Click out of textarea field.
- Field value returns to value in step 1. (“Baseline” or blank)
- beforeChange condition changed to return true
- Click into textarea field.
- Field value remains “Baseline” or blank.
- Click out of textarea field.
- Field value changes to “Changed value”.
Hello @kcasarez ,
Regarding both points:
Expected behavior: Returning false for “beforeChange” event on dhx.Form would prevent changing the value of form fields.
It looks like an issue on our end, thank you for noticing it. I already sent it to the dev team, and they will try to fix it in future versions.
Kind regards,