Page 1 of 1

Masked input

Posted: Tue Sep 11, 2012 10:09 pm
by alexandr

Masked input allows to enter the data in certain format (dates,phone numbers, etc).
Example (123)123-123-1


Re: Masked input

Posted: Tue Sep 11, 2012 11:18 pm
by zmakcw

Here's a good solution digitalbush.com/projects/masked-input-plugin/
If the developers have integrated into PHPmaker it would be very good.


Re: Masked input

Posted: Wed Sep 12, 2012 10:00 am
by Webmaster

Since it is JavaScript, you can do that yourself easily:

  1. Enable "Use jQuery" in Advanced Settings (no need for newer versions which always use jQuery),
  2. Put your jquery.maskedinput.js in the "phpjs" folder of your site,
  3. Include the script by Page_Head server event,

ew_AddClientScript("phpjs/jquery.maskedinput.js");

  1. Setup your masks in Startup Script, e.g. in Add page,

$("#x_YourField1").mask("99/99/9999");
$("#x_YourField2").mask("(999) 999-9999");

(Also read Server Events and Client Scripts in the help file for more info about the events.)


Re: Masked input

Posted: Sat Nov 10, 2012 9:20 pm
by made

i have field "NUMBER"
i follow all the steps..

  1. Enable "Use jQuery" in Advanced Settings, (not necessary since v9, jQuery is always included)
  2. Put jquery.maskedinput.js in the "phpjs" folder of my site,
  3. Include the script:
    ew_AddClientScript("phpjs/jquery.maskedinput.js");
    on Page_Head server event
  4. Setup masks in client scripts-table specific-Startup Script on add page and edit page
    $("x_NUMBER").mask("99-99-9999");

but on add page or edit page nothing happens. am i missing something?


Re: Masked input

Posted: Mon Nov 12, 2012 9:43 am
by Webmaster

jQuery requires a selector, use $("#x_YourField1").


Re: Masked input

Posted: Sat Aug 24, 2013 10:11 pm
by SouzaRM

I did it!
Was putting on the event [Client scripts - Table specific - Client script],
when the correct thing in [Client scripts - Table specific - Startup Script].


Re: Masked input

Posted: Tue Dec 03, 2013 7:31 am
by noimad1

Question for you guys on this one. I followed your steps, and as far as the add/edit pages goes the mask (phone number in (999)999-999) is working fine. however, for some reason on the "view" and "list" pages, it is just showing "0" in the field. Any idea what could be causing that?


Re: Masked input

Posted: Mon Jan 13, 2014 1:36 pm
by noorshiam

I have followed all steps as explain above, but nothing happend on add or edit page. My field is time type, field name : "TimeIn" and setup mask like this : $("#x_TimeIn").mask("99:99");

Is that wrong?


Re: Masked input

Posted: Wed Jun 04, 2014 4:26 am
by ronaldoo

Hello, anyone knows how to do? I want it to mask phone number fields like "(xx)xxxx-yyyy". Thank you.


Re: Masked input

Posted: Tue Oct 10, 2017 9:58 pm
by rodrigofaustino2

Why does not grid work with multiple lines?


Re: Masked input

Posted: Mon Oct 29, 2018 4:38 pm
by kirondedshem

nothing has changed it still works as expected, the point is to include the js file in page_head so its available for use, then call your jquery to set mask on specific field.

  • got and download the zip repo from github.com/digitalBush/jquery.maskedinput
    -extract it go to demo index and see how it works, also open the index page in notepad so you see what you need to do to implement it else where, that is see what they are including when and how they are using the library

nway
-1. copy the jquery.maskedinput.min.js into some where i your project, eg i create a folder called "custom_plugin" and paste the file in there
-2. go to page_head event and paste the code below to include this file into all your files.

<script src="custom_plugin/jquery.maskedinput.min.js" type="text/javascript"></script>

-3. Now all you have to do is paste jquery in startup script of any page to initialise the input fields (refer to examples in the demo index file for how to use also refer to thier docs), for example go to your table->client scripts->add page->startup script and paste something like this.

// initialise the model field as a phone number
$("#x_Model").mask("(999) 999-9999");

-3. regenerate all files and its done, if its not working check the console log for errors

HINT:All web application libraries follow the same approach just find out what files it needs to work and include them into your project, then find out how you use the library's implementation


Re: Masked input

Posted: Mon Dec 03, 2018 9:56 pm
by MBQ

I tried this and works well until you use an Android device.

Any options?

Thanks!


Re: Masked input

Posted: Wed Jul 24, 2019 11:09 am
by msduransti

Hello!

I'm new to PHP Maker and i just want to be clarified regarding the use of jquery.maskedinput.js.

what does this file contain?

thanks