Announcement

Collapse
No announcement yet.

Pressing Cancel in UI does not restore the original value of field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pressing Cancel in UI does not restore the original value of field

    I am using a BeforeSave hook to validate/process edits made in the front-end.

    Here is the sequence of events:

    I click on the detail field pencil icon to start editing a field.
    After entering new value, I click on <Update> button.
    The back-end rejects the edit with an Error exception as follows:

    PHP Code:
    // generate UI error message
    throw Error::createWithBody(
      
    $error->getMessage(),
      
    Body::create('Update Error: ' $error->getMessage())->encode()
    );
    ​ 
    The error is shown in UI and the edit does not complete.
    At this point the new value is in the field input still in edit mode.
    I click on the <Cancel> button.
    The field does NOT revert to the original value.
    If I refresh the page, now the field shows the original value since edit was never saved.

    Shouldn't the UI restore the original value in this situation?

  • #2
    Will be fixed in v8.3.2.

    Comment


    • #3
      Thank you yuri.

      I have a related question.

      I have custom entity = MyEntity.
      This entity has a relationship to the Contact entity labeled as "Specialist Assigned".
      I have custom AfterUnrelate hook.

      The user unrelates a contact using detail edit:
      Click image for larger version

Name:	image.png
Views:	107
Size:	9.6 KB
ID:	107879
      When the user clicks on "X" to remove the Contact, and then clicks "Update", this will fire my AfterUnrelate​ hook.
      In my hook, I perform some validations, and is some circumstances, I may clear the values in other fields in MyEntity.

      However, in the UI those fields will have previous values since the hook was triggered with a detail edit.
      Is there anyway for the hook (backend code) to trigger a model sync and view reRender so that the altered values are updated in the view?

      Comment

      Working...
      X