[MGNLFORM-245] Enable formSubmit component to add a Cancel button on the form template Created: 16/Sep/14  Updated: 02/Dec/14  Resolved: 27/Nov/14

Status: Closed
Project: Magnolia Form Module
Component/s: validation
Affects Version/s: 2.2.6, 2.2.7, 2.2.8
Fix Version/s: 2.2.9

Type: Improvement Priority: Neutral
Reporter: Lars Fischer Assignee: Christoph Meier
Resolution: Fixed Votes: 0
Labels: form, support, uzh
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2014-09-16 at 11.28.16.png    
Issue Links:
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Enable formSubmit component to add a Cancel button.
When clicking the cancel button, the form should be cleared and it should not show validation problems from previous requests anymore.


Original description:
>>>>>>
This is only concerning a single form, not multi-step.

To reproduce the problem:

  • in the demo project go to service/contact (author instance)
  • add the cancel/back button to the submit part
  • enter preview mode
  • enter an invalid email address and some text in the message field
  • submit the form by clicking "send"

Clicking on the "Cancel" button now should clear the form but it doesn't.
This may be caused by the fact that a "back" button is used instead of a "cancel" button.
<<<<<



 Comments   
Comment by Christoph Meier [ 24/Nov/14 ]

The "Back" button has been used to "create" a "Cancel" button.
But the form doesn't provide a cancel button component.

When the "Back" button is clicked, the form is submitted, FormStateEngine and Validation is triggered => this then leads to the Validation problem which is rendered.

For a "real" cancel button, existing component "formSubmit" can be extended to allow to add a cancel button.

Comment by Christoph Meier [ 24/Nov/14 ]

Changes committed onto branch "MGNLFORM-245".

Comment by Christoph Meier [ 27/Nov/14 ]

I've added some javascript which "clears" the form (all beside hidden fields) and removes validation error markers when clicking cancel button.
This way all the "action" appears on the client to avoid messing up form-engine-state on server side.
The JS is a bit frumpy but we cannot rely on jquery or something similar.

Generated at Mon Feb 12 05:38:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.