[FIX] website_forum: use other attr than value to init select2

The backend would otherwise fail because the value has been already processed
This commit is contained in:
Jeremy Kersten 2014-12-01 17:27:50 +01:00 committed by Olivier Dony
parent ad1ca233ca
commit 5d58b5551f
2 changed files with 2 additions and 3 deletions

View File

@ -171,7 +171,7 @@
// Take default tags from the input value
initSelection: function (element, callback) {
var data = [];
_.each(JSON.parse(element.val()), function(x) {
_.each(element.data('init-value'), function(x) {
data.push({ id: x.id, text: x.name, isNew: false });
});
element.val('');
@ -179,7 +179,6 @@
},
});
//TODO Remove in master
if($('input.load_tags').length){
var tags = $("input.load_tags").val();
$("input.load_tags").val("");

View File

@ -376,7 +376,7 @@
<div t-if="not is_answer">
<br/>
<input type="hidden" name="tag_type" value="select2"/>
<input type="hidden" name="question_tag" class="form-control col-md-9 js_select2" placeholder="Tags" t-attf-value="#{tags}"/>
<input type="hidden" name="question_tag" class="form-control col-md-9 js_select2" placeholder="Tags" value="see data init value" t-attf-data-init-value="#{tags}"/>
<br/>
</div>
<button class="btn btn-primary btn-lg">Save</button>