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


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 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

Аватар
Відмінити
Найкраща відповідь

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>

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
січ. 20
5758
1
черв. 23
1976
1
трав. 23
1948
1
жовт. 22
4104
5
груд. 24
33187