D
D
dexdev2014-01-10 18:50:43
JavaScript
dexdev, 2014-01-10 18:50:43

Why is rails not passing data to the database when using mask.input?

There is a form, the form is writing to the database from the user,
I used jquery.maskedinput.js, and in the posts.js.coffee file I indicated

jQuery ->
  $('#post_date').datepicker
    dateFormat: 'yy-mm-dd'
   $("#ssn").mask("99:99");
   $("#phone").mask("(999) 999-9999");

the datepicker works fine,
ssn too, but when it comes to phone, everything is sad in the database, the value passed by the user is not saved, either 0 or nothing
at all is indicated
<%= f.text_field :phone, :id => "phone", class: "form-control" %>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dexdev, 2014-01-16
@AdilA

The question was of course noobish... it turned out that the phone field in the database was an integer, changed it to a string and everything worked, I wonder why when using masked input 0 was written to the database, and without it everything was written normally as it should have been...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question