on ‎2019 Jul 03 7:34 PM
Hi,
How could I get new form values from a JSP PAGE, and send them to AddToCartController.
I know that I have to create a class similar to AddToCartForm to have the new fields that I want to send to the controller. But I am not sure about the proccess.
Please your help.
Thanks!
Request clarification before answering.
Hi
You have to first add the new attribute to add to cart form. send the form using model attribute from controller to jsp
In jsp, you already will have form accessed using commandName or name form field. now you can have your new attribute from form in any input field.
for testing just add hard coded value to input field.so now when you submit the form you will have post method which is taking form as parameter and in this method you can get the values form the form liek it is done for qty and product code which is coming from storefront/jsp
Let me share some more details which will help you to understand and implement the task
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi You can see the add to cction jsp which is used for addToCction. but it will be good if you through the main landing layout jsp and see how the add to cction is called on the jsp/tag.
Just have a look on product layout jsp and try debugging the jsp/tag code for pdp which will help you to get more context about frontend and storefront
Please let me know if this helps you.
Hi ,
Thanks again for your help. Is there a problem if I add the new input for the new atrributes that i created for the cartentry in this form?.
Could you please send me an example in regards how to add new input is this form, and how do you get the values in the AddToCartController? is it necessary to edit an existing form class or could I have my custom form for my new attributes ?.
Thank you so much!.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.