• I would like to add number fields to a contact form using html instead of Contact Form 7 shortcodes.

    The code is:

    <input required class=”miles” type=”number” pattern=”/^-?d+.?d*$/” onKeyPress=”if(this.value.length==1) return false;” /><span style=”font-size:38px;”>,</span><input required class=”miles” type=”number” pattern=”/^-?d+.?d*$/” onKeyPress=”if(this.value.length==1) return false;” /><input required class=”miles” type=”number” pattern=”/^-?d+.?d*$/” onKeyPress=”if(this.value.length==1) return false;” /><input required class=”miles” type=”number” pattern=”/^-?d+.?d*$/” onKeyPress=”if(this.value.length==1) return false;” /><span style=”font-size:38px;”>,</span><input required class=”miles” type=”number” pattern=”/^-?d+.?d*$/” onKeyPress=”if(this.value.length==1) return false;” /><input required class=”miles” type=”number” pattern=”/^-?d+.?d*$/” onKeyPress=”if(this.value.length==1) return false;” /><input class=”miles” type=”number” pattern=”/^-?d+.?d*$/” onKeyPress=”if(this.value.length==1) return false;” / required ><input required style=”margin-top:-40px !important;” class=”miles” type=”number” pattern=”/^-?d+.?d*$/” onKeyPress=”if(this.value.length==1) return false;” />

    https://drive.google.com/file/d/1C_acdZ2wNnkn6F8QgVobfnLJVdh2hPZW/view?usp=sharing

    How do I add these fields to the email template?
    Also, how do I make the fields required? Adding the required tag to the input field doesn’t work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @msslrb,

    I’m afraid the number form tag doesn’t support the pattern attribute or onKeyPress event, but you can add your own custom form tag following the instructions you find here: Adding a custom form-tag.

    Best regards,
    Yordan.

    Thread Starter msslrb

    (@msslrb)

    The form works fine. It just doesn’t give the validation error.

    I would like to know how to add any html field submission to the email that I received when a form is submitted.

    Thread Starter msslrb

    (@msslrb)

    Okay. I created custom form tags. The field populates correctly. However, I’m still unable to add it to the email template and make it required.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘html’ is closed to new replies.