-
-
Notifications
You must be signed in to change notification settings - Fork 364
[LiveComponent] Update doc on how to use submitForm #2510
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
[LiveComponent] Update doc on how to use submitForm #2510
Conversation
src/LiveComponent/doc/index.rst
Outdated
// 'form' is the name of the form you're submitting (here FormType). | ||
// e.a : form submitted is EntityCreationType the name of your form would be 'entity_creation' and should replace 'form' in the below submitForm call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to remove the text and use another word than "form" in the exemple..
Something like "create_comment" or "my_form" .
wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, I didn't want to update the "core" of the documentation but if it's a possibility, we could indeed do something like:
// Submit form data ('my_form' for your MyFormType form)
$testComponent
->submitForm(['my_form' => ['input' => 'value']], 'save');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed that modification
src/LiveComponent/doc/index.rst
Outdated
// 'form' is the name of the form you're submitting (here FormType). | ||
// e.a : form submitted is EntityCreationType the name of your form would be 'entity_creation' and should replace 'form' in the below submitForm call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 'form' is the name of the form you're submitting (here FormType). | |
// e.a : form submitted is EntityCreationType the name of your form would be 'entity_creation' and should replace 'form' in the below submitForm call | |
// 'form' is the name of the form you're submitting (here FormType). | |
// e.a : form submitted is EntityCreationType the name of your form would be 'entity_creation' and should replace 'form' in the below submitForm call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why i was doing that but when looking at the actual render it was properly aligned... Anyhow, a new commit has been made with a simplification of the comments
5afd2e4
to
a7db6f7
Compare
Thank you @yalit. |
Thanks for the approval and merge! |
As described in the issue, I struggled a bit with the usage of the submitForm helper for testing a LiveComponent due to the name of the form used not being correct see #2509.
I propose a small update to the documentation to make it more clear how the formName should be used into the call of submitForm