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

     Im trying to get array[0] as value for the 'attroption' and array[1] as value for 'attrweight' in the code below. How can I do this? Or is there any other way to set this value? 

<div style="visibility: hidden" t-esc="value_id.name" id="attributename"/>                                    
<div style="visibility: hidden" id="attributeextraweight"/>
<script type="text/javascript">
var input = $("attributename").text();
var array = input.split('+');
$("attributename").html(array[0]);
$("attributeextraweight").html(array[1]);
</script>
<t t-set="attroption" t-value=""/>
<t t-set="extraweight" t-value="attrweight"/>
Аватар
Відмінити
Найкраща відповідь

HI,

You can set like this

<t t-set="attroption" t-value="value_id.name.split('+')[0]"/>

<t t-set="extraweight" t-value="value_id.name.split('+')[1]"/>

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
3
серп. 17
8990
0
січ. 25
942
0
лют. 24
1207
0
серп. 23
2321
1
лют. 23
2674