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

fix(formvalidation): update/add missing settings #469

Merged
merged 5 commits into from
May 22, 2023

Conversation

lubber-de
Copy link
Member

@lubber-de lubber-de commented May 21, 2023

Description

Some settings were missing or had oldfashioned values

@mvorisek
Copy link
Contributor

If this is/should be the default behaviour for the reason described in fomantic/Fomantic-UI#2791 (comment):

When a form is initialized it automatically also initializes an existing dropdown or calendar (to be able to set their defaults or bind to a clear/reset event.

the docs info is fine.

But this does not solve fomantic/Fomantic-UI#2791, because:

a) immediately self closing form tag is broken - I have created dedicated issue for it - fomantic/Fomantic-UI#2792
b) component design is broken as long as form component initialize child components

to be able to set their defaults or bind to a clear/reset event

In atk4/ui DOM we can add/remove form field even after the form has been init. Would it be possible to introduce a setting to not init any field by the form module? In atk4/ui we init every field component manually, thus any auto init is problematic.

@lubber-de
Copy link
Member Author

lubber-de commented May 21, 2023

component design is broken as long as form component initialize child components

I consider this a feature 😄

The .form() init can be applied to some parent tag (as you did), it doesnt matter if it contains empty/multiple/nested) forms inside (i will look at at fomantic/Fomantic-UI#2792 afterwards how / if this is affected)

Would it be possible to introduce a setting to not init any field by the form module?

Anyway, i added an option to ignore module init when a form is initiated now by fomantic/Fomantic-UI#2793
See https://jsfiddle.net/lubber/3pLrgvsa/1/

However, dealing with "reset" or "clear" of a form will still reset/clear such fields and, if not already initiated beforehand, will trigger the init nevertheless (which is consistent, if by the time a form should be reset/clears manually / via buttons dropdown/calendar isnt already initiated, something went wrong in the app logic (that's why those modules are initiated at form init by default)

If you still/also don't want this either:
The selector setting is the key here to adjust it according to your needs.
You can adjust the selector setting and adjust the uiDropdown, uiCalendar, uiCheckbox values to an empty string. So those won't get recognized / handled at all and your app should take care of them manually.

// 
$('#myid').form({
    selector: {
        uiDropdown: '',
        uiCalendar: '',
    }
})

@mvorisek
Copy link
Contributor

Thank you for your perfect reply.

However, dealing with "reset" or "clear"

Can form "reset" or "clear" be called by anything else than manual (ie. from custom even handler/code) invocation?

@lubber-de
Copy link
Member Author

Can form "reset" or "clear" be called by anything else than manual (ie. from custom even handler/code) invocation?

Those are bound to the selector.clear and selector.reset settings.
So if you dont want this either, set such to an empty string as well. But from the app logic, before anybody can click such clear/reset buttons, the manual instantiation of the undesired modules should have been done already.

@lubber-de lubber-de marked this pull request as draft May 21, 2023 19:17
@lubber-de lubber-de changed the title fix(formvalidation): add info about dropdown/calendar auto init fix(formvalidation): update/add missing settings May 22, 2023
@lubber-de lubber-de added Missing Content Missing documentation and removed enhancement labels May 22, 2023
@lubber-de lubber-de marked this pull request as ready for review May 22, 2023 17:25
@lubber-de lubber-de merged commit 457aa71 into fomantic:develop May 22, 2023
@lubber-de lubber-de deleted the formdropdowncalendarinitinfo branch May 22, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing Content Missing documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants