TYPO3-Headless / headless_powermail

Connects together EXT:headless and EXT:powermail
GNU General Public License v2.0
0 stars 6 forks source link

PHP Warning: Undefined array key in PrefillMultiFieldViewHelper.php line 209 #34

Open kitzberger opened 3 months ago

kitzberger commented 3 months ago

@lukaszuznanski, I stumbled upon this issue again and tried to make sense of what's the real problem here.

Maybe you can help me understand this excerpt from the check/radio/select/country field partials:

    <headlesspowermail:form.registerField property="{field.marker}."
                            value="{setting.value}"
                            checked="{vh:misc.prefillMultiField(field:field, mail:mail, cycle:index.cycle)}"/>

It's used to create the trustedProperties, right? E.g.

{
  "name": "tx_powermail_pi1[__trustedProperties]",
  "value": "{\"field\":{\"anrede\":1,\"vorname\":1,\"nachname\":1,\"strasse\":1,\"hausnummer\":1,\"plz\":1,\"ort\":1,\"land\":1,\"country\":1,\"email\":1,\"newsletter\":[1]}}34a29410e84c1f4afb07b7d002fda0503bde9b3f"
},

Why does headlesspowermail:form.registerField have to have the parameters value and checked though? In my opinion that's not necessary at all.

And checked is using the prefillMultiField viewhelper with a wrong cycle parameter, what's the intention behind that?

_Originally posted by @kitzberger in https://github.com/TYPO3-Headless/headless_powermail/issues/29#issuecomment-1742745027_

kitzberger commented 3 months ago

The problem occurs only when running into a serverside validation error and the form is being rendered again. It's the checked argument that is causing the problems and I'm convinced now that it's not necessary at all. In my project I've removed them and it's not causing any problems anymore...