Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
6188 Visualizações

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>
Avatar
Cancelar
Melhor resposta

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 ();
Avatar
Cancelar
Melhor resposta

Thanks bro is very helpful

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
ago. 20
5365
2
dez. 18
27393
1
ago. 15
5496
0
mar. 15
4993
1
mai. 24
1371