0

I need add some custom attribues to inputs from Contact Form 7, but without using JS.

For eg. I need add data-timepicker="true" and data-language='en' - those attributes are for Air-Datepicker plugin.

I was trying create those attributes with JS and it's works, but not for Air-Datepicker - probably JS works to late.

So, how can I do that without JS?

  • Does this answer your question? [How to add a custom attribute?](https://stackoverflow.com/questions/46274317/how-to-add-a-custom-attribute) – Tofandel Jul 03 '20 at 08:53

1 Answers1

1

You could just add the input directly into your form, after copying the output from the form on the page.

For example... If you add the form tag

<label>The Date</label>

[text* the-date]

on the output of the form when you view the source on the page you've pasted the contact form shortcode, you'll see this:

<label>Enter Date</label>
    <span class="wpcf7-form-control-wrap the-date"><input type="text" name="the-date" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false"></span>

Then copy it back to your form and replace your form tag [the-date] with:

<label>Enter Date</label>
        <span class="wpcf7-form-control-wrap the-date"><input type="text" name="the-date" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false" data-timepicker="true" data-language="en"></span>

Just make sure you include in your email [the-date] - as it won't show up on the mail tab to remind you.

Howard E
  • 5,454
  • 3
  • 15
  • 24