Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe Exam AD0-E716 Topic 11 Question 44 Discussion

Actual exam question for Adobe's AD0-E716 exam
Question #: 44
Topic #: 11
[All AD0-E716 Questions]

An Adobe Commerce Developer is tasked with creating a custom form which submits its data to a frontend controller They have decided to create an action and have implemented the \Magento\Framework\App\Action\HttpPostActioninterface class, but are not seeing the data being persisted in the database, and an error message is being shown on the frontend after submission.

After debugging and ensuring that the data persistence logic is correct, what may be cause and solution to this?

Show Suggested Answer Hide Answer
Suggested Answer: C

According to the Magento Stack Exchange answer, form key validation is a security feature that prevents CSRF attacks by checking if the form key in the request matches the one generated by Magento. If the developer does not include the form_key in their custom form, the validation will fail and an error will be shown. Therefore, the developer needs to add the form_key to their requests by using <?= $block->getBlockHtml ('formkey') ?> in their template file. Verified Reference: https://magento.stackexchange.com/questions/95171/magento-2-form-validation


Contribute your Thoughts:

Micaela
24 days ago
Haha, I bet the developer is kicking themselves for forgetting the form_key. That's like Ecommerce 101, you know? At least it's an easy fix.
upvoted 0 times
...
Olen
25 days ago
Wait, I thought Magento allowed POST requests to frontend controllers. This sounds like a trick question to me. Better double-check the documentation just in case.
upvoted 0 times
...
Huey
28 days ago
Ah, I see the problem now. The developer forgot to implement the validatePostData method. That's a common oversight that can lead to issues with data persistence.
upvoted 0 times
Adrianna
14 days ago
User 1: Did you check if the developer implemented the validatePostData method?
upvoted 0 times
...
...
Jennie
1 months ago
Or maybe they forgot to implement the validatePostDataQ method in their action.
upvoted 0 times
...
Gwen
1 months ago
I agree, maybe the developer needs to rewrite the submission functionality as an API endpoint.
upvoted 0 times
...
Elliot
1 months ago
Hmm, I'm not sure if that's the problem. Didn't the question mention the developer checked the data persistence logic and it was correct? Sounds like a deeper issue to me.
upvoted 0 times
Corrina
8 days ago
A) Magento does not allow POST requests to a frontend controller, therefore, the submission functionality will need to be rewritten as an API endpoint.
upvoted 0 times
...
...
Page
1 months ago
I think the issue here is the form key validation. The developer needs to add the form_key to their requests to ensure the submission is valid.
upvoted 0 times
...
Sunny
2 months ago
I think the issue might be with the POST request to the frontend controller.
upvoted 0 times
...

Save Cancel