Skip to Content
Menu
This question has been flagged
2 Replies
6205 Rodiniai

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>
Portretas
Atmesti
Best Answer

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 ();
Portretas
Atmesti
Best Answer

Thanks bro is very helpful

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
rugp. 20
5368
2
gruod. 18
27402
1
rugp. 15
5501
0
kov. 15
5002
1
geg. 24
1396