user can enter emails
user can write any email in the field
This commit is contained in:
parent
d8970f00c4
commit
6cc2efd925
1 changed files with 22 additions and 1 deletions
|
|
@ -7,7 +7,28 @@
|
||||||
.panel-body
|
.panel-body
|
||||||
%p
|
%p
|
||||||
%b Select/Enter Emails
|
%b Select/Enter Emails
|
||||||
= text_field_tag :to, '', class: 'form-control'
|
= text_field_tag :to, '', class: 'form-control', id: 'admin_email_to'
|
||||||
%br
|
%br
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= link_to 'Send Email', '', class: 'btn btn-primary'
|
= link_to 'Send Email', '', class: 'btn btn-primary'
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$(document).ready(function() {
|
||||||
|
var $select = $('#admin_email_to').selectize({
|
||||||
|
delimiter: ',',
|
||||||
|
persist: true,
|
||||||
|
plugins: ['remove_button'],
|
||||||
|
labelField: 'item',
|
||||||
|
valueField: 'item',
|
||||||
|
sortField: 'item',
|
||||||
|
searchField: 'item',
|
||||||
|
create: function(input) {
|
||||||
|
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(input)){
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
item: input
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue