Skip to content

Commit

Permalink
Validating phone number and add a mask
Browse files Browse the repository at this point in the history
  • Loading branch information
alabeduarte committed Oct 24, 2013
1 parent 45d1cdb commit 2c9eb95
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions public/js/billbo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
$(function() {

// Phone number
$("input[type=tel]").mask("+99 (99) 9999-9999");

// Search
$('#search_field').keyup(function() {
var val = $(this).val().toLowerCase();
Expand Down
7 changes: 7 additions & 0 deletions public/js/vendor/jquery.maskedinput.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions views/bills/_reserve_fields.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="form-group">
<label for="phone_number"><%= I18n.t(:phone_number) %></label>
<input name="phone_number" type="text" autofocus class="form-control">
<input name="phone_number" type='tel' pattern='[\+]\d{2}\s[\(]\d{2}[\)]\s\d{4}[\-]\d{4}' title='+99 (99) 9999-9999' autofocus class="form-control" required>
</div>
<div class="form-group">
<label for="email"><%= I18n.t(:email) %></label>
<input name="email" type="text" required value="<%= session['email']%>" class="form-control">
<input name="email" type="email" required value="<%= session['email']%>" class="form-control" required>
</div>
<div class="text-right">
<button type="submit" class="btn btn-success"><%= I18n.t(:reserve_bill) %></button>
Expand Down
1 change: 1 addition & 0 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<script src="/js/vendor/jquery.tipsy.js"></script>
<script src="/js/billbo.js"></script>
<script src="/js/vendor/jquery.tinysort.min.js"></script>
<script src="/js/vendor/jquery.maskedinput.min.js"></script>
<script type="text/javascript">
window.i18n = <%= locale_labels %>
</script>
Expand Down

0 comments on commit 2c9eb95

Please sign in to comment.