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

please help me someone

how to get web form values into controllers in Odoo for custom login functionality

Avatar
Discard
Best Answer

Hi,

in your template if you have added the input field inside a form, then below the form add a submit button. Upon clicking the submit button , the route mentioned in the action along with the form will be called ,

<form action="/test/path" method="post" data-success_page="/thanks" class="s_website_form form-horizontal container-fluid mt32" >    
       # add the input fields here
       <div class="form-group form-field o_website_form_required_custom">
           <label class="col-md-3 col-sm-4 control-label" for="name">Name</label>
             <div class="col-md-7 col-sm-8">
                 <input type="text" class="form-control o_website_form_input" name="name" required=""/>
            </div>
        </div>
       <div class="form-group">
            <div class="col-md-offset-3 col-sm-offset-4 col-sm-8 col-md-7">
                <span id='submit' class="btn btn-primary btn-lg o_website_form_send">Submit</span>
                <span id="o_website_form_result"></span>
            </div>
       </div>
</form>

Then in the controller,

@http.route('/test/path', type='http', methods=['POST'], auth="public", website=True, csrf=False)
def test_path(self, **kw):
    #here in kw you can get the inputted value
    print kw['name']

Thanks

Avatar
Discard
Author Best Answer

Dear niyas   thank you for this, can u pls explain with one field how to get from form in controller

thanks






Avatar
Discard

check the updated answer

Author

Thanks for your reply Niyas

I am getting the below-mentioned error while submitting the form.

" an error has uccerd form has been not sent"

can you please explain is any thing is needed

can you please explain to me what is the

For those who are getting " an error has uccerd form has been not sent" error:

Use <button type="submit" class="btn btn-primary">Submit</button>