› Forums › Classic DFFS › Rules are not correctly applied on load in EditForm
- This topic has 2 replies, 1 voice, and was last updated 1 year, 4 months ago by SteveE.
January 16, 2022 at 14:37 #35469Maciek GrischkeParticipant
I have a problem with rules not being properly applied on “form load or field change” in the EditForm.
I have a big Incident Report Form that starts with a Radio Choice field and 4 options called Type of Incident. They are:
– Behavioural (Not OK)
– Non-Behavioural (Not OK)
– Accident (Not OK)
– Medication Error (OK)
All other fields depend on this “choice field”.
In NewForm, all seems to be ok, but not in EditForm. Not all fields are shown/hidden and not all rules are applied. Debugging isn’t showing me anything obvious but everything is green.
When I edit the item (Behavioural, non-Behavioural or Accident incident report), the Type of Incident (radio field) should be read-only, but it isn’t, though it seems to work for Medication incidents. (see attached JSON config). The radio choice is selected and I can change it (and I shouldn’t be able to), and when I click on the radio field, the rule then gets applied correctly and all fields are shown/hidden correctly and the Type of Incident choice field becomes read-only, as it should from the beginning when the form loads.
DFFS version is 126.96.36.199 for EditForm (I updated it to see if it makes any difference) and 188.8.131.52 for NewForm.
Attached is a JSON config file for both the NewForm and EditForm. Is it possible that the config is corrupt in any way?
Only some of the fields are not visible or are visible and shouldn’t be, for example, if it’s a Non-Behavioral incident:
– “Client Group” field should be visible, but is not
– “What happened immediately before the behaviour? (antecedent/trigger)” field should be hidden, but is visible
There are a few more, but not many. Completely random and not at all obvious why those fields are playing up and not others.
I’d appreciate some advice on this.
January 16, 2022 at 14:56 #35471Maciek GrischkeParticipant
The attached JSON for EditForm does not include the “Accident” Rule because as soon as I add it, it breaks Behavioural and Non-Behavioural rules. Medication rule is still working.
January 27, 2022 at 19:42 #35541SteveEParticipant
I can’t look at the json, but most likely you have conflicting rules in editform that load with the form. In newform it’s probably base on “change” so it seems to work fine then. I would use “Find In Rules” and highlight the rules that are attached to the same field. If you have more than rule deciding whether it is hidden or not, you need to change the rules or the order of the rules. Turn rules on and off one by one and see what is conflicting and play around with how to get it to behave correctly.
- You must be logged in to reply to this topic.