Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
9202 Ansichten


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
Verwerfen
Autor Beste Antwort

I cannot use it like this, when saving the record ... the modified information is not saved, in that field.
I guess due to the lack of user interaction

Avatar
Verwerfen
Beste Antwort

Hi,

i think your code is not executed. you need to write that JS code in static js using script function in form.

You can do something like:

<field name="arch" type="xml">

<form>

<script type="text/javascript">


$(document).ready(function() {

    //DOM manipulation code

});

<!-- can write fields and header or anything here -->

</script>

</form>

</field>

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Jan. 20
5767
1
Juni 23
2004
1
Mai 23
1962
1
Okt. 22
4125
5
Dez. 24
33205