Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form] Add dirty and clean states, and ability to cancel submit #661

Merged
merged 1 commit into from
Apr 11, 2019

Conversation

prudho
Copy link
Contributor

@prudho prudho commented Apr 11, 2019

First, a great kudo to @simontaite for inspiring me this. I'm using his plugin on a lot of projects and it works well with FUI.

This PR add the ability to define a state for the form: clean or dirty. Default state is clean and is changed to dirty when the user change at least one field. Reseting a form also change state to clean. Theses events are now triggered:

  • onDirty()
  • onClean()

Dirty fields can be showed by using the get dirty fields behavior.

State can also be changed programmaticaly by using behaviors set as clean and set as dirty. Its now also possible to prevent a user form leaving the page if the form is in dirty state, using preventLeaving: true, which can be useful when you don't want to loose data.

Bonus point: Dropdown are now correctly restored when calling the behavior reset.

@prudho prudho added type/feat Any feature requests or improvements lang/javascript Anything involving JavaScript state/awaiting-reviews Pull requests which are waiting for reviews state/awaiting-docs Pull requests which need doc changes/additions labels Apr 11, 2019
@prudho prudho added this to the 2.7.5 milestone Apr 11, 2019
Copy link
Member

@y0hami y0hami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@ColinFrick ColinFrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@y0hami y0hami merged commit adf5937 into fomantic:develop Apr 11, 2019
@y0hami y0hami removed state/awaiting-reviews Pull requests which are waiting for reviews labels Apr 11, 2019
@prudho prudho deleted the form.dirty branch April 11, 2019 12:58
@lubber-de lubber-de added state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo and removed state/awaiting-docs Pull requests which need doc changes/additions labels Apr 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/javascript Anything involving JavaScript state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo type/feat Any feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants