Hello,
Are input mask possible and if so how? To be more specific phone and currency masks, such as (xxx)xxx-xxxx. I am new to Codeigniter and Grocerycrud so specific examples would be very helpful.
Thanks for taking the time to read this.
⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠
Posted 19 February 2013 - 17:27 PM
Hello,
Are input mask possible and if so how? To be more specific phone and currency masks, such as (xxx)xxx-xxxx. I am new to Codeigniter and Grocerycrud so specific examples would be very helpful.
Thanks for taking the time to read this.
Posted 19 February 2013 - 19:05 PM
Posted 19 February 2013 - 19:05 PM
Posted 19 February 2013 - 19:28 PM
Victor thanks. I'm sorry if my questions are at the beginner level. I have a few years of php experience and a little javascript experience. I'm trying to learn oop, codeigniter and grocerycrud.
Where should I put the javascript and how should I call it?
Thanks!
Posted 19 February 2013 - 19:31 PM
Posted 19 February 2013 - 19:37 PM
On the input.
Posted 19 February 2013 - 20:06 PM
Posted 19 February 2013 - 20:25 PM
Here is a site that offers the javascript code with a demo.
http://digitalbush.com/projects/masked-input-plugin/
I don't know where to install it in grocerycrud.
Posted 19 February 2013 - 20:32 PM
Posted 20 February 2013 - 01:17 AM
Making progress. I found Grocerycrud already loads jquery. I loaded the input mask javascript file after the jquery load. After changing your code slightly I was able get the mask to show up and could enter the phone number properly but it won't save what I typed in.
Here is what I changed your code to :
jQuery(function($){
$("#field-phone").mask("(999)999-9999",{placeholder:"_"});
});
If I used ".field-phone" instead of "#field-phone" the mask wouldn't show up.
Also if I used "(___)) ___-____ " as the place holder it kept repeating itself.
(___)) ___-____(___)) ___-____(___)) ___-____(___)) ___-____
Again thanks for your help.
Posted 20 February 2013 - 17:26 PM
It looks like I have it working now. I changed the field type from INT to varchar and the length from 10 to 13.
Thanks a lot for your help Victor.