-
-
Notifications
You must be signed in to change notification settings - Fork 213
Closed legend cause problem with form validation #8300
Comments
|
Legends should always be open if they contain mandatory fields. Can the issue be reproduced in the online demo? |
|
Well you can manually close them… |
|
You can reproduce it in the online demo.
|
|
|
That only works after reload, which does not happen with browser validation… |
|
Sections with mandatory fields should be opened again via JavaScript before the form is submitted. |
|
@aschempp Don't know if you have listened, but the video clearly says:
|
|
@leofeyer the problem occurs when the user collapses a section manually (see netzarbeiter's reproduction steps). The video only states, that sections are always uncollapsed if there are mandatory fields in them when a record is opened. This works as expected. However, this is not what this issue is about. |
|
@fritzmg The initial description is:
So I don't think it is about manual collapsing. But it actually does not matter, because Contao should never collapse a section containing mandatory fields – no matter if the section was closed by default or manually. |
I don't agree with that. I often collapse sections, regardless of whether they contain mandatory fields or not, while I create or edit a record which has a lot of sections, to get a better overview. Imho it would be detrimental to the user experience if you suddenly disallow the collapse of sections containing mandatory fields. |
|
Yeah, I think opening them before the form is submitted, makes more sense. |
Yes, but only if those fields contain a value. Otherwise collapsing does not make any sense at all, because not filling in the fields will lead to an error message upon submit. Therefore Contao will always open sections if there are empty mandatory fields. |
No, I meant I collapse all fields and open them one by one while creating/editing a record. Just because I collapse a section does not necessarily mean I do not intend to enter any values in the contained fields while editing/creating a record.
Do you mean when loading an entry? Yes, that currently works as expected and does not need to be changed. I was concerned you want to remove the functionality to be able to collapse sections containing mandatory fields altogether. The issue here only arises if you manually collapse a section containing a mandatory field and then click any of the $('.tl_submit_container [type="submit"]').click(function(){
$(this).parents('form').find('fieldset').each(function(){
if($(this).find('[required]').length > 0){
// un-collapse this fieldset
}
});
}); |
|
Fixed in 36fbc41. |
### 4.1.3 (2016-04-22) * Use data URIs for the image preview in the back end. * Use DIRECTORY_SEPARATOR to convert kernel.cache_dir into a relative path (see #464). * Always trigger the "isVisibleElement" hook (see contao/core#8312). * Do not change all sessions when switching users (see contao/core#8158). * Do not allow to close fieldsets with empty required fields (see contao/core#8300). * Make the path related properties of the File class binary-safe (see contao/core#8295). * Correctly validate and decode IDNA e-mail addresses (see contao/core#8306). * Skip forward pages entirely in the book navigation module (see contao/core#5074). * Do not add the X-Priority header in the Email class (see contao/core#8298). * Determine the search index checksum in a more reliable way (see contao/core#7652).
If a legend with mandatory fields is closed by default there is a problem with form validation.
Legend closed:

Legend opened:

The text was updated successfully, but these errors were encountered: