Closed lubber-de closed 1 year ago
If this is/should be the default behaviour for the reason described in https://github.com/fomantic/Fomantic-UI/issues/2791#issuecomment-1556168676:
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 https://github.com/fomantic/Fomantic-UI/issues/2791, because:
a) immediately self closing form tag is broken - I have created dedicated issue for it - https://github.com/fomantic/Fomantic-UI/issues/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.
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 https://github.com/fomantic/Fomantic-UI/issues/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 https://github.com/fomantic/Fomantic-UI/pull/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: '',
}
})
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?
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.
Description
Some settings were missing or had oldfashioned values