コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
6197 ビュー

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
5368
2
12月 18
27399
1
8月 15
5500
0
3月 15
5001
1
5月 24
1387