Skip to Content
Menu
This question has been flagged
2 Replies
15278 Views

Good afternoon, 
I'm working with the web module in odoo 11 and I have the following question.
How from a <form action = "/webdemo/cpe"> can I send the value of a parameter to the method of a cotrolador?
For example I have the following urls:
URL 01
http://localhost:8068/webdemo/webdemo

Which contains a text box (name=color_id) and a button

URL 02
http://localhost:8068/webdemo/cpe?color_id=3

I want to know how is it done so that when I press the button, it will generate the second URL? since until now it only generates me in this way

http://localhost:8068/webdemo/cpe

PD: The controller /webdemo/cpe receives as parameter color_id

Avatar
Discard

Odoo Web Controller

Reference 1: https://goo.gl/gPjPas

Reference 2: https://goo.gl/SEHNbA

Best Answer

Hi,

You can receive the values entered in the input field inside the controller like this, once the submit button is pressed, the value entered in the form will be passed to corresponding controller defined in the action. Then in the controller,


As shown in the above image, in the kwargs you will receive the input data from the form and retrieve each value from there.

Check: https://github.com/odoo/odoo/tree/12.0/addons/website_sale/controllers

Thanks

Avatar
Discard
Author Best Answer

Perfect!
Thank you very much for your help, it has worked for me!

Avatar
Discard