Rules are not correctly applied on load in EditForm

Forums Classic DFFS Rules are not correctly applied on load in EditForm

Viewing 2 reply threads
  • Author
    Posts
    • #35469
      Maciek Grischke
      Participant

      Hello all,

      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 4.4.5.39 for EditForm (I updated it to see if it makes any difference) and 4.4.5.14 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.

      Many thanks

      Attachments:
    • #35471
      Maciek Grischke
      Participant

      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.

    • #35541
      SteveE
      Participant

      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.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.