Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
9714 Lượt xem

How can we redirect website page after submitting a form ?

I have made a custom form in my odoo website v 12 . I want if some one submit that form by pressing the submit button it should redirect to thank you page .. 

any module or any guide ? 

Thanks in advance.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Try writing return function inside controller, So you can redirect specific user to specific URL. found a similar question check this link

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

I wanted to do the same thing and I found a way, but I don't know if it's the best way ^^".

To do this I used the `werkzeug` tool.

```
import werkzeug

@http.route(['/form/submit'], type='http', auth="public", methods=['POST'], website=True, csrf=True)
    def check_form(self, **post):
        # ...
        return werkzeug.utils.redirect("form/success", 301)

@http.route(['/form/success'], type='http', auth="public", website=True, csrf=True)
    def success_page(self, **post):
        return http.request.render('form.success', post)
```
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 24
14385
2
thg 3 18
5193
0
thg 1 18
3337
2
thg 2 24
25788
3
thg 2 25
55752