ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Chrome won't submit comment form when url field has "http://" pre-filled

June 19, 2011 5:53pm

Subscribe [3]
  • #1 / Jun 19, 2011 5:53pm

    bytte

    47 posts

    One of my users complains she can’t fill out the comments form on a blog post without entering the url field (which is not required).

    Attached is a screen shot of the problem. From what I see it’s Chrome (latest version, windows) interupting the submitting. It probably thinks the “http://” is not a valid url so it won’t submit.

    If she deletes the “http://”, Chrome has no problem submitting the form.

    Here’s the code I used in my template for the comment form:

    <label for="url">Website:</label> <input class="text" type="url" autocapitalize="off" name="url" value="{url}" size="50" />

    How can I fix this problem? Can I remove the pre-filled http:// and what happens if users then submit an url such as

    <a href="http://www.myblog.com">http://www.myblog.com</a>

    ? Will it break the link?

  • #2 / Jun 20, 2011 1:11pm

    John Henry Donovan

    12339 posts

    bytte,

    You can just remove the value in your input like so

    <label for="url">Website:</label>
    <input class="text" type="url" autocapitalize="off" name="url" value="" size="50" />

    Let us know if that works for you

  • #3 / Jun 20, 2011 5:04pm

    bytte

    47 posts

    Thanks John, but then it won’t be pre-filled with cookie data if a user entered his url on my site before?

  • #4 / Jun 21, 2011 1:46pm

    Kyle Cotter

    730 posts

    Hi bytte,

    You are using an HTML5 form element, that being type=“url”. Having a value of value=”{url}” in the input defaults to “http://” for non-logged in members. Chrome then forces you to either enter a URL, or remove the http://.

    There are two ways around this.

    One, is you change the input type from “url” to just a regular “text” input. Chrome won’t interfere with it.

    The other option is to do as John said and remove the value of the input. To address your issue of pre-populating the field for returning visitors, you can utilize the {if logged_out} conditional.

    For members, ExpressionEnigne already knows their emails and other data, therefore these fields are not required to be displayed to them.

    So, you can display the URL, email, and name inputs to logged_out members, and just have the comment textarea for logged_in members as EE already knows the other values.

    Hope this clarifies.

    Thanks.

  • #5 / Jun 22, 2011 9:12am

    bytte

    47 posts

    Thanks. Great help!

  • #6 / Jun 22, 2011 10:16am

    Kyle Cotter

    730 posts

    Awesome bytte!

    Glad you got everything taken care of! Please feel free to post again as needed.

    Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases