EmailNameTextfield
Text area entry tool that allows you to paste e-mail names and addresses from common
mail clients such as Gmail, Yahoo! and Outlook. This tool will recognize the pasted
input and parse out the first and last name as well as validating the e-mail address.
Demo
Requirements
- Rails
- JQuery
- CoffeeScript
- Backbone.js
- Underscore.js
Installation
Add this line to your application's Gemfile:
gem 'email_name_textfield'
And then execute:
$ bundle
Add this line to your application.js file after the lines that require
Backbone.js and Underscore.js:
//= require email_name_textfield
Include the css file in your application.css file:
@import "email_name_textfield";
Usage
Reference this text area by creating a new object:
myemailnamefield = new EmailNameTextField.EmailInputAreaView(placeholder: "email@address.com")
The placeholder text is simply the text that will appear by default when no e-mail
addresses are shown.
Now, render this object to your view:
$("mydiv").html(myemailnamefield.render())
Emails will be immediately validated upon pasting or losing the focus on the text area.
To access the resulting list of emails and names call:
myemailnamefield.name_data()
Result will be an array of JSON objects in the format of:
{ firstName: "Mary", lastName: "Smith", email: "msmith@example.com" }
Supported email formats
Other formats
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request