Forum

Thread tagged as: Problem, Blog, Comments

Blog Comments form not submitting

If the reader fills out the comment form and adds a website URL in the 'commentURL' but doesn't include 'https://' the form does not submit, leaving them unsure if it's been submitted or not.

adding https:// before the url allows the form to submit.

Template (std Perch comment_form.html)

<perch:if id="postAllowComments" value="1">

    <perch:form id="comment" method="post" app="perch_blog" class="comment-form" action="<perch:blog id="postURL" />">
        <fieldset>
           <legend>Leave a comment</legend>
            <div>
                <perch:label for="commentName">Name</perch:label>
                <perch:input type="text" id="commentName" required="true" label="Name" antispam="name" />
                <perch:error for="commentName" type="required">Required</perch:error>
            </div>
            <div>
                <perch:label for="commentEmail">Email</perch:label>
                <perch:input type="email" id="commentEmail" required="true" label="Email" antispam="email" />
                <perch:error for="commentEmail" type="required">Required</perch:error>
                <perch:error for="commentEmail" type="format">Check format of address</perch:error>
            </div>
            <div>
                <perch:label for="commentURL">Website</perch:label>
                <perch:input type="url" id="commentURL" placeholder="https://" label="URL" antispam="url" />
            </div>
            <div>
                <perch:label for="commentHTML">Comment</perch:label>
                <perch:input type="textarea" id="commentHTML" required="true" label="Message" antispam="body" />
                <perch:error for="commentHTML" type="required">Required</perch:error>
            </div>
            <div>
                <perch:input type="hidden" id="postID" value="<perch:blog id="postID" />" />
                <perch:input type="submit" id="submitComment" value="Submit" />
            </div>

        </fieldset>
        <perch:success>
            <p>Thank you. Your comment has been submitted and will appear on the site once approved.</p>
        </perch:success>

    </perch:form>
</perch:if>

Simon Clay

Simon Clay 127 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

I imagine that is the HTML5 browser validation coming into play. If it hit Perch we would use our error checking on the serverside.

Simon Clay

Simon Clay 127 points

I see, I was testing in Webkit browsers, which give no visible message or feedback. In Firefox a proper query is shown 'Please enter a URL' .

Is there a way to stop browser validation?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use a plain text field rather than a URL field.

Simon Clay

Simon Clay 127 points

Thanks Drew and Rachel, I chose to add

placeholder="please include https://"