← Back to team overview

mahara-contributors team mailing list archive

[Bug 1560329] [NEW] The block config's "cancel" button breaks after a Pieform validation failure

 

Public bug reported:

To replicate:

1. Drag a new "external media" block into your page.
2. In the block config modal that opens up, hit "submit" without filling in the required "URL or embed code" field
3. Press "Submit"
4. Wait for the form to reload and display the warning message telling you about the required field
5. Once that loads up, press the "Cancel" or "Remove" button/link next to the "Submit" button.

Expected result: The block config modal window closes, and the new
external media block is no longer on your page

Actual result: The screen reloads, and you now have an empty "external
media" block on your page

The reason this is happening, is because the Pieforms "cancel" button by
default just reloads the form's action URL, or the cancel button's
"goto" URL. When we load up the block config modal, we use Javascript
code to rewire the cancel button so that it instead closes the modal
and, if the block is new, deletes the block.

However, when Pieforms fails validation, Pieforms actually removes the
current form displayed on the page, and replaces it with a new form that
contains the validation errors. Because this is a completely different
form object, the "rewiring" that we did when we opened the modal no
longer applies.

** Affects: mahara
     Importance: Medium
     Assignee: Aaron Wells (u-aaronw)
         Status: In Progress

** Affects: mahara/15.10
     Importance: Medium
     Assignee: Aaron Wells (u-aaronw)
         Status: In Progress

** Affects: mahara/16.04
     Importance: Medium
     Assignee: Aaron Wells (u-aaronw)
         Status: In Progress

** Also affects: mahara/15.10
   Importance: Undecided
       Status: New

** Also affects: mahara/16.04
   Importance: Undecided
       Status: New

** Changed in: mahara/15.10
   Importance: Undecided => Medium

** Changed in: mahara/16.04
   Importance: Undecided => Medium

** Changed in: mahara/15.10
     Assignee: (unassigned) => Aaron Wells (u-aaronw)

** Changed in: mahara/16.04
     Assignee: (unassigned) => Aaron Wells (u-aaronw)

** Changed in: mahara/15.10
       Status: New => In Progress

** Changed in: mahara/16.04
       Status: New => In Progress

** Changed in: mahara/15.10
    Milestone: None => 15.10.2

** Changed in: mahara/16.04
    Milestone: None => 16.04.0

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1560329

Title:
  The block config's "cancel" button breaks after a Pieform validation
  failure

Status in Mahara:
  In Progress
Status in Mahara 15.10 series:
  In Progress
Status in Mahara 16.04 series:
  In Progress

Bug description:
  To replicate:

  1. Drag a new "external media" block into your page.
  2. In the block config modal that opens up, hit "submit" without filling in the required "URL or embed code" field
  3. Press "Submit"
  4. Wait for the form to reload and display the warning message telling you about the required field
  5. Once that loads up, press the "Cancel" or "Remove" button/link next to the "Submit" button.

  Expected result: The block config modal window closes, and the new
  external media block is no longer on your page

  Actual result: The screen reloads, and you now have an empty "external
  media" block on your page

  The reason this is happening, is because the Pieforms "cancel" button
  by default just reloads the form's action URL, or the cancel button's
  "goto" URL. When we load up the block config modal, we use Javascript
  code to rewire the cancel button so that it instead closes the modal
  and, if the block is new, deletes the block.

  However, when Pieforms fails validation, Pieforms actually removes the
  current form displayed on the page, and replaces it with a new form
  that contains the validation errors. Because this is a completely
  different form object, the "rewiring" that we did when we opened the
  modal no longer applies.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1560329/+subscriptions


Follow ups