• Resolved wileycoyote78

    (@wileycoyote78)


    Hello,

    I am building a custom template from scratch. I know, I’m doing it the hard way, but I won’t learn if I do it the easy way. I searched the forums, and the only posts I could find with this error are dealing with plugins (i.e. JetPack), but I don’t have any plugins installed at all.

    Anyway, I am running into a problem with the comments form. I am only on localhost while I build out the theme, so I don’t have a link to a page.

    If you haven’t guessed from the title of this topic, when I hit submit on the comment form I get the following message:

    Error: Please fill the required fields (author,email)

    Yes, I have filled the fields with a name and e-mail. Obviously if I uncheck the “Comment author must fill out name and email” it works. But here is what I don’t get: If I switch to any of the “twenty” themes, the form works just fine with the “Comment author…” option turned on. This happens with the default comments.php and my own comments.php file.
    What am I missing? Any help would be greatly appreciated.

    P.S.: If I need to create a live page with my theme installed, I can do it.

    • This topic was modified 2 years, 3 months ago by wileycoyote78.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    How have you created the comment form? Somehow, WP isn’t seeing appropriate data in the $_POST data that it is expecting. If you use comment_form() with all of its defaults, it should work correctly. If you’ve altered fields by filter or parameter, that could have changed the data structure that was submitted.

    Thread Starter wileycoyote78

    (@wileycoyote78)

    @bcworkz:

    Thanks for the pointer. Yup! That’s what it was. Have you read the Expeditionary Force series by Craig Alanson? I feel like Skippy after Joe has pointed out the obvious.
    I had customized the email field to change the type from text to email (which I could have done post load with JS, but why run extra code, right?) and forgot to add the “name” attribute.

    I am marking this as resolved.

    Lesson learned: In forms, the input fields MUST have the name attribute in order for them to work properly. If you are customizing the input fields for any of the WP built in forms, make sure the “name” attributes match what the API is looking for.

    If I could post a Tommy Boy gif right now, it would be the one where he repeatedly slaps his forehead saying, “Stupid! Stupid! Stupid!” LOL.

    Thanks again!

    Moderator bcworkz

    (@bcworkz)

    Don’t feel bad, we’ve all been there. Sadly I’m unfamiliar with your literary references. The mods here use a Slack channel to communicate, where the Picard :facepalm: emoji is quite common.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error: Please fill the required fields’ is closed to new replies.