Giter VIP home page Giter VIP logo

gravity-forms-data-attributes's Introduction

Gravity Forms Data Attributes

This plugin allows you to add custom data attributes to Gravity Forms fields.

It should work with:

  • all of the Standard field types
  • any of the Advanced field types that only have one input field (e.g., Email but not Address)
  • the List advanced field type, including with multiple columns (thanks @reddo!).

For fields with choices, such as checkboxes, you can assign separate values for each data attribute for each choice (the UI for this is ugly right now ๐Ÿคทโ€).

Usage

For each field you want to enable data attributes for:

  1. On the field's General settings tab, check the Enable Data Attributes box.
  2. In the Data Attribute Names field that appears, enter one data attribute name (e.g., my-attribute) per line.
    • Do not prefix your attribute name with data-. The plugin will do that for you,
  3. Save your form.
  4. Reopen the field settings. You will now see additional setting fields where you can enter the value of each data attribute you added.
    • For fields with choices, such as checkboxes, the data attribute value settings appear next to each choice's name and value fields.
    • For other fields, the data attribute value settings will appear underneath the Data Attribute Names field.

Installation

There are three options for installing this plugin:

  1. With composer from Packagist: composer require mmirus/gravity-forms-data-attributes
  2. With GitHub Updater
  3. By downloading the latest release ZIP from this repository and installing it like any normal WordPress plugin

Contributing

To work on this project (for yourself or to contribute a PR):

  1. Clone this repo
  2. Run composer install
  3. Run yarn or npm install

And you should be good to go.

Pre-commit linting is enforced (see .eslintrc.js and .stylelintrc.js for scripts and styles; PHP uses PSR-2).

Screenshots

Settings for a field without choices

Alt Text

Settings for a field with choices (checkboxes)

Alt Text

gravity-forms-data-attributes's People

Contributors

dependabot[bot] avatar mmirus avatar reddo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

reddo goranseric

gravity-forms-data-attributes's Issues

Uncaught ReferenceError: ToggleDataAttrs is not defined

Plugin was working fine until I updated Gravity Forms from 2.4.21.8 to 2.4.22.
I have tried reverting back to the previous version and that didn't fix it.

I am getting the following Javascript error when I click the "Enable Data Attributes" toggle:

  • Uncaught ReferenceError: ToggleDataAttrs is not defined

Toggling field clears "Enable Data Attributes" checkbox

The plugin was working flawlessly a couple of days ago, but I've made some changes to my forms today and almost all of the fields that had data attributes enabled got disabled somehow. It's doing this constantly when toggling a field open, even if I re-enable them. It's getting really frustrating, as I'm using this plugin for a lot of fields.

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.