Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
6206 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
серп. 20
5371
2
груд. 18
27406
1
серп. 15
5503
0
бер. 15
5003
1
трав. 24
1396