Skip to Content
Menu
This question has been flagged
1 Atsakyti
9933 Rodiniai

     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"/>
Portretas
Atmesti
Best Answer

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]"/>

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
3
rugp. 17
9158
0
saus. 25
1078
0
vas. 24
1335
0
rugp. 23
2462
1
vas. 23
2803