PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Better way to style credit card fields?

  1. hmdev
    Member

    I was surprised to find that the credit card field built into Gravity Forms is extraordinarily hard to style, for two reasons. First, there are inline styles - with the !important declaration, no less - hard coded into some of the input elements. Second, there is no class name on the expiration date container or on the individual month/year select elements within it.

    Because of this, I had to hook into the credit card field input with 'gform_field_content'. Then I had to write a horrendous little script which uses DOMDocument to strip out style tags and add classes to some of the elements. It was either this or do it with JavaScript, which I did not want to do.

    Here is that script: http://pastebin.com/vmBLKgWu

    I'm pasting this here because I really hope that I'm missing something, and that there is a better way to do what I'm attempting. Please let me know if this is not the case.

    Posted 5 years ago on Wednesday February 13, 2013 | Permalink
  2. I'm not seeing any inline styles when I view the source of one my test forms on my dev site. Screenshot

    Also - what exactly are you trying to do to the credit card field in terms of styling? There are plenty of classes and IDs here to hook into. Do you have a link to your form?

    Posted 5 years ago on Wednesday February 13, 2013 | Permalink
  3. hmdev
    Member

    I'm seeing now that this may have been caused by an add-on altering the default credit card fields. I'll swing back here if that's not the case.

    Posted 5 years ago on Wednesday February 13, 2013 | Permalink
  4. Please let us know what add-on it turned out to be, if that was the conflict.

    Posted 5 years ago on Sunday February 17, 2013 | Permalink
  5. hmdev
    Member

    Sorry for the long delay. It was the plugin. It was a custom script used by a friend to connect to a proprietary payment system; not an official add-on. All is fixed. Thanks!

    Posted 5 years ago on Thursday March 14, 2013 | Permalink
  6. Thanks for the update.

    Posted 5 years ago on Thursday March 14, 2013 | Permalink

This topic has been resolved and has been closed to new replies.