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

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

Open
kitzberger opened this issue Mar 20, 2024 · 2 comments

Comments

@kitzberger
Copy link
Contributor

@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 #29 (comment)

@kitzberger
Copy link
Contributor Author

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...

kitzberger added a commit to GFEMediaGmbH/headless_powermail that referenced this issue Aug 2, 2024
This occurs on failed serverside validations: The form field "tx_powermail_pi1[field][mycheckboxes][][]" is invalid. Reason: "[]" used not as last argument, but somewhere in the middle (like foo[][bar]).

Related: TYPO3-Headless#34
@kitzberger
Copy link
Contributor Author

Removing the attributes checked from the viewhelper "call" didn't solve all problems. So I super-simplified the RegisterFieldViewHelper to the bare minimum, see #37

I cannot see why this viewhelper was so complicated in the first place. Maybe left-overs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant