跳至内容
菜单
此问题已终结
2 回复
6216 查看

Using JS, the field in the view is updated, but pressing the save button does, not save the value in the field.

JS code:

var FormController = require('web.FormController');
FormController.include(
{
_onButtonClicked: function (event)
{
if(event.data.attrs.id === "action_addpoint")
{
$("input[name='points'].o_input_points")
.val("save_a_modified_field_with_JS")
.focus()
.change();
}
},
});

XML Code:

<header>
<button id="action_addpoint" string="Add point"/>
</header>
<group col="4">
<field name="points" class="points"/>
</group>
形象
丢弃
最佳答案

I had the same problem.

Try this. This still does not work for relational fields fields though but will work for others. 

$ ("input [name = 'points']. O_input_points") .val ("save_a_modified_field_with_JS"). change (). focus ();
形象
丢弃
最佳答案

Thanks bro is very helpful

形象
丢弃
相关帖文 回复 查看 活动
1
8月 20
5373
2
12月 18
27419
1
8月 15
5506
0
3月 15
5010
1
5月 24
1400