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

i can access the posted data in controller only for the first button the second controller of seconf button doesnt get the posted data how can i fix this please 

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

HI,

In HTML5 there is An Attribute Called formaction, The formaction attribute overrides the form's action attribute,

the formaction attribute specifies where to send the data when clicking on that button,

Syntax :

<button type='submit' formaction='<specify the controller>' >

example

<button type="submit" formaction="/first_controller">First action</button>


<button type="submit" formaction="/second controller">Second action</button>

This attribute is only supported button with type='submit'

Regards

Ảnh đại diện
Huỷ bỏ

Hi,
I need to have two buttons in my form, one for temporary save (which the user can modify in the future) and the other for final save (cannot be changed anymore).
Should I use the same method you described?

Hello
Thank you for your guidance,
I used this method for two different controllers, but in Odoo16, when I click on each of them, I get an error that was not there before in Odoo13.

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
at JSON.parse (<anonymous>)

Because the website is multilingual, the form that is sent to the controller is no longer http? How should I get the values in the controller or is there another problem.

please guide me.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 18
25127
1
thg 6 24
2668
1
thg 1 24
14312
1
thg 5 22
3789
1
thg 9 20
2862