Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
6163 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

Thanks bro is very helpful

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
ago 20
5365
2
dic 18
27385
1
ago 15
5481
0
mar 15
4990
1
mag 24
1368