Giter VIP home page Giter VIP logo

masked_acf_field's Introduction

Masked ACF Field

Installation

Just upload the masked-field.php file into your theme folder in a subfolder called acf-fields. Upload the maked_input.js file into the same folder, subfolder assests.

To enable use of the field, simply include the following in your functions.php file from your theme.

  	if(function_exists('register_field')) {
			register_field('Masked_field', dirname(__FILE__) . '/acf-fields/masked-field.php');
		}

Usage

To use the field, select the field Maked Field in ACF when creating the field group. In the fomatting field, specify the following to define your style:

  • a - Represents an alpha character (A-Z,a-z)
  • 9 - Represents a numeric character (0-9)
  • * - Represents an alphanumeric character (A-Z,a-z,0-9)

In any combination that you want to mask. For example:

(999) 999-9999 <- Phone Number
a9a-9a9 <- Postal Code

Examples

Inputting (999) 999-9999 will result in input such as A-Z to be disallowed in the field. Additionally, it will enforce the mask:

(___) ___-____

Which will be saved to the database. It will then when called return the full masked value: (###) ###-####. Where # represents a number entered into the field.

Testing

This has been tested fully with the Advanced Custom Fields Plugin (v3.1.8) and jQuery included in Wordpress (v3.3.2). None of this would have been possible without the Masked Input Plugin for jQuery Plugin by Josh Bush (v1.3) over at digitalbush.com.

Comments/Issues

If you have any questions, please let me know via my contact form on http://www.wyattjohnson.ca/. Or if That doesnt work, because Wordpress is not infallible, by email wyatt [at] wyattjohnson.ca.

Any Issues can be submitted via the Github page https://github.com/Wyattjoh/Masked_ACF_Field/. Or of course if you have anything to add just send me a pull request.

Copyright

Copyright (c) 2012-2013 Wyatt Johnson (wyattjohnson.ca) Licensed under the MIT license

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

masked_acf_field's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.