WordPress.org

Forums

[Plugin: Jetpack] Contact form incorrectly shows "Error!" for required field (3 posts)

  1. paulzee
    Member
    Posted 1 year ago #

    I'm having trouble with the following contact form, where the user correctly enters content in the one required field, but on submit the page is updated with the text "Error!", and the message "What primary areas of interest do you have? (e.g. crafting, electronics, 3D printing, etc) is required". Note that this is the one required field, and simple text was provided as content (e.g. the word "crafting"):

    [contact-form to='info@euriskomelbourne.com' subject='[euriskomelbourne.com participant enquiry'][contact-field label='What primary areas of interest do you have? (e.g. crafting%26#x002c; electronics%26#x002c; 3D printing%26#x002c; etc)' type='text' required='1'/][contact-field label='Are there any specific things that you would  you like to get from the eurisko event?' type='textarea'/][contact-field label='It would help us if you could tell us a little about yourself: your approximate age%26#x002c; level of experience%26#x002c; etc. Note that you don%26#039;t need to provide us with your name or email address.' type='textarea'/][contact-field label='If you%26#039;d be happy for us to contact you to ask you further questions or answer questions you have%26#x002c; please check here and provide us with your email address' type='checkbox'/][contact-field label='Name' type='name'/][contact-field label='Email' type='email'/][contact-field label='Do you have any questions for us?' type='textarea'/][/contact-form]

    (FYI: no feedback is recorded)

    The only difference from other forms that work for me is the email address field not being a required field. I don't want an email address to have to be supplied (this is anonymous feedback), and I've supplied a 'contact-form to' address to record the feedback. Even if I'm logged into the site, and the email and name fields are auto populated, I still get the error.

    I also tried two other alternatives: one with the email address as a text field, and one with no email address field, but I still get the error:

    [contact-form to='info@euriskomelbourne.com' subject='[euriskomelbourne.com participant enquiry'][contact-field label='What primary areas of interest do you have? (e.g. crafting%26#x002c; electronics%26#x002c; 3D printing%26#x002c; etc)' type='text' required='1'/][contact-field label='Are there any specific things that you would  you like to get from the eurisko event?' type='textarea'/][contact-field label='It would help us if you could tell us a little about yourself: your approximate age%26#x002c; level of experience%26#x002c; etc. Note that you don%26#039;t need to provide us with your name or email address.' type='textarea'/][contact-field label='If you%26#039;d be happy for us to contact you to ask you further questions or answer questions you have%26#x002c; please check here and provide us with your email address' type='checkbox'/][contact-field label='Name' type='name'/][contact-field label='Do you have any questions for us?' type='textarea'/][/contact-form]

    At one point during debugging/ analysis I also got a "Are you sure you want to do this?" with no actionable command option message page after clicking Update while editing the page in WordPress admin. That message appeared well after the problem first surfaced, and hasn't appeared since.

    Have I made an error I can't see?

    Any help or suggestions much appreciated!

  2. paulzee
    Member
    Posted 1 year ago #

    Well, after some extensive testing, I appear to have discovered (rediscovered?) three bugs with Jetpack Contact Forms, and I gotten quite far analysing two of them. The third is reproducible with the example code below, but without any real insight so far.

    Here's a revised version of the contact form that *almost* works fine (see note about missing fields below):

    [contact-form to='info@euriskomelbourne.com' subject='euriskomelbourne.com: participant feedback'][contact-field label='What are your primary areas of interest? (eg. crafting%26#x002c; 3D printing%26#x002c; etc)' type='text' required='1'/][contact-field label='Are there any specific things that you would you like to get from the eurisko event?' type='textarea'/][contact-field label='It would help us if you could tell us a little about yourself: your approximate age%26#x002c; level of experience%26#x002c; etc. Note that you don%26#039;t need to provide us with your name or email address.' type='textarea'/][contact-field label='If you%26#039;d be happy for us to contact you to ask you further questions or answer questions you have%26#x002c; please check here and provide us with your email address' type='checkbox'/][contact-field label='Name' type='name'/][contact-field label='Email' type='email'/][contact-field label='Do you have any questions for us?' type='textarea'/][/contact-form]

    The problems:

    1) The length of a Field Label for a required field cannot exceed 73 characters. The 74th character reproduces the problem. Note also that this is the resolved length of the Label: the actual stored length can e longer, including any special HTML codes.

    2) Note that if the field is not a required field, it appears that the Field Label can be longer, and in many cases the field will appear to work successfully. However, I'm not certain that can be relied on.

    3) Unfortunately, as others have noted, some of the fields on the form don;t appear in the feedback output. In the case of the form above, [contact-field label='Are there any specific things that you would you like to get from the eurisko event?' type='textarea'/] does not appear in the feedback output. I am uncertain exactly what factor triggers this, as field listed sequentially before and after in the form declaration appear correctly. I wondered if this might also be related in some way to the label length problem.

    4) It appears that Square Brackets - [ and ] - are problematic in the field inputs. In my case, I had tried to include them in the email subject line text, and one or both of the brackets was being dropped. If these were coverted to HTML codes instead during input, that might resolve the issue.

    Initially I'd suspected the HTML codes or special characters in the label were the source of the problem, so I was surprised when my testing discounted that in favor of the length being the issue.

    If these bugs are known limitations, it would be good to add a more informative error message to the page at runtime to aid debugging, or at least log something to the PHP Error log. Some additional input cleansing/ error handlers during input would help, however because the shortcode text can be manually edited, this would only help prevent some errors being introduced.

    PS - I tried a couple of times to get the form example here marked up as code, but it doesn't appear to work.

  3. Jeremy Herve
    Happiness Engineer
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic