From #2326757: Conditionals Broken - Select option determines displayed fields

SIDE NOTE: I also noticed that while creating conditions, if, before I select "Save conditions", I select the "+" and create a If foo is empty then hide bar condition, then select "+" to add another condition, the "Is empty" portion will change to "is" every time, without fail. If I select "Save conditions" between the addition of each "Is empty" condition, this does not happen. This also seems to occur when I drag and drop the condition to adjust it's weight, before selecting "Save conditions".

This is consistently reproduced. It may be related to other issues against conditional definition, but I've created this separate issue because it is easily reproduced. When fixed, we can investigate whether it helps other issues.

EDIT: The issue is broader and easier to reproduce. Create a conditional using a select component with any operator. Save. Then edit the operator to a different one and click (+) to add a new conditional. The change you made to the first conditional's operator will be lost.

Comments

danchadwick’s picture

Title: Creating two conditionals without saving loses operator selection of first » Adding a conditional loses unsaved operator choice(s).
Issue summary: View changes

  • DanChadwick committed 4e64162 on 7.x-4.x
    Issue #2327817 by DanChadwick: Fixed Adding a conditional loses unsaved...
  • DanChadwick committed 70f96d9 on 8.x-4.x
    Issue #2327817 by DanChadwick: Fixed Adding a conditional loses unsaved...
danchadwick’s picture

Status: Active » Fixed
StatusFileSize
new2.63 KB

This patch fixes the above issue by checking to see if, when a change to a source component choice is detected, the appropriate options for the operator are the same as what the conditional already has. If so, then they are not updated (which loses the selection).

This patch also:

  1. Fixes a minor issue where a global $context jQuery variable was created instead of the local variable intended.
  2. Optimizes the multiple-creator of jQuery objects that are identical.
  3. Fixes the inadvertent deferral of the code used to avoid re-binding the same handlers until the execution of the handler. The intention is to prevent them as soon as the hander is bound, rather than first executed.

I am somewhat hopeful that this fix may address other related issues (yet to be confirmed / tested).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.