Hi everyone,
I'm facing difficulties using data-multiple. During the last week I've been trying several approaches to make it work with no sucess.
I'm listing the content, but it is not inserting the comma and giving the option of a new select.
I've added in my application.js the following:
new Awesomplete('input[data-multiple]', { filter: function(text, input) { return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]); }, replace: function(text) { var before = this.input.value.match(/^.+,\s*|/)[0]; this.input.value = before + text + ", "; } });
and in my _form.html.erb for this input, I'm using:
<%= f.text_field :objeto_de_acao, :class => 'awesomplete', :list => 'objetos', :data => { :multiple => ''} %> <datalist id="objetos"> <% action_objects_array.each do |action_object| %> <option><%= action_object[0].to_s %></option> <%end%> </datalist>
For what I've seen in the advanced examples, this is all I probably need to do. Am I missing anything?
thanks ins advance.
Hi everyone,
I'm facing difficulties using data-multiple. During the last week I've been trying several approaches to make it work with no sucess.
I'm listing the content, but it is not inserting the comma and giving the option of a new select.
I've added in my application.js the following:
new Awesomplete('input[data-multiple]', { filter: function(text, input) { return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]); }, replace: function(text) { var before = this.input.value.match(/^.+,\s*|/)[0]; this.input.value = before + text + ", "; } });and in my _form.html.erb for this input, I'm using:
<%= f.text_field :objeto_de_acao, :class => 'awesomplete', :list => 'objetos', :data => { :multiple => ''} %> <datalist id="objetos"> <% action_objects_array.each do |action_object| %> <option><%= action_object[0].to_s %></option> <%end%> </datalist>For what I've seen in the advanced examples, this is all I probably need to do. Am I missing anything?
thanks ins advance.