winter icon indicating copy to clipboard operation
winter copied to clipboard

BelongsTo relationship fields lose data when saved if hidden in filterFields()

Open LukeTowers opened this issue 4 years ago • 6 comments

Refs octobercms/october#3568

LukeTowers avatar Mar 12 '21 05:03 LukeTowers

I am able to reproduce it into the test plugin following the original author guidelines.

I found that when disabled/hidden from the model using listFields methods, the relation widgets (tested on recordfinder and basic relation widget) get the wrong formField config in getSaveValue which probably cause this issue:

  • inside getSaveValue: ->formField->hidden (or disabled) are always false
  • this makes them return null (and not FormField::NO_SAVE_DATA)
  • this null returned is causing the "null saving" into the database here: https://github.com/wintercms/winter/blob/32440b19b92eeaaefaa0478d5170101e6cf1113e/modules/backend/traits/FormModelSaver.php#L77-L81

I just can't get atm when inside the saving process: the field which is initialized at hidden/disabled = true, lost his state to retrieve its default.

Also, is that normal that the record finder never return FormField::NO_SAVE_DATA? This will probably make this bug persist even if we fix the initial cause.

Réf: https://github.com/wintercms/winter/blob/develop/modules/backend/formwidgets/RecordFinder.php#L242-L245

RomainMazB avatar Jul 19 '21 20:07 RomainMazB

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

github-actions[bot] avatar Sep 18 '21 00:09 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

github-actions[bot] avatar Nov 18 '21 00:11 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

github-actions[bot] avatar Jan 19 '22 00:01 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

github-actions[bot] avatar Mar 21 '22 00:03 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

github-actions[bot] avatar May 21 '22 00:05 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].

github-actions[bot] avatar Nov 20 '22 00:11 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].

github-actions[bot] avatar May 22 '23 00:05 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].

github-actions[bot] avatar Nov 23 '23 00:11 github-actions[bot]