PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Gravity Plugin Causes Numerous W3C HTML Validation Errors

  1. silverlight001
    Member

    Hi,

    Before I added the Gravity plug-in my site passed the W3c markup validation service.

    After adding the plugin it now fails on 8 counts (all seemingly due to the gravity plugin)

    Please advise,

    http://www.macprosol.com

    Thanks

    http://pastie.org/1338236

    Posted 9 years ago on Wednesday December 1, 2010 | Permalink
  2. We'll take a look at it. I'm assuming you tried to validate the home page with the form in the footer section.

    http://j.mp/gjiaSV

    Next time, please use Pastie or PasteBin to post long blocks of code, etc. It's easier to read in that context. Thanks.

    Posted 9 years ago on Wednesday December 1, 2010 | Permalink
  3. silverlight001
    Member

    Thanks, yes,

    I tried to validate the home page with the form in the footer section.

    Looks like the code gravity forms uses is causing it to fail html validation.

    Posted 9 years ago on Monday December 20, 2010 | Permalink
  4. We've updated some of the markup for better validation in the latest 1.5 version. You can download the latest Release Candidate from the downloads page and see if that solves the problems.

    Posted 9 years ago on Monday December 20, 2010 | Permalink
  5. silverlight001
    Member

    Hi,

    I tried this but still have HTML validation errors:

    This is a bit frustrating since I'm keen to ensure my site passes the W3c validation - please can you get this rectified or let me know what code element needs to be manually updated please:

    Line 194, Column 306: document type does not allow element "link" here
    …nt/plugins/gravityforms/css/forms.css?ver=3.0.4' type='text/css' media='all' />

    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

    Posted 9 years ago on Tuesday February 8, 2011 | Permalink
  6. Can you post a link to your form page so we can review it?

    Posted 9 years ago on Tuesday February 8, 2011 | Permalink
  7. silverlight001
    Member

    Hi,

    I deactivated the plugin - copied the release candidate and then re-activated but it broke the form so I had to revert back to the previous version by re-activiating it

    It gives 8 html errors

    http://validator.w3.org/check?uri=http%3A%2F%2Fwww.macprosol.com%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.1

    form is on every page:

    http://www.macprosol.com

    Theme is Metric from Studiopress

    Posted 9 years ago on Wednesday February 9, 2011 | Permalink
  8. You can try the current 1.5 beta release and see how it does. Most of these issues have been corrected in the new version. If you do upgrade to the beta version, let us know if you still run into validation problems with the form.

    Posted 9 years ago on Wednesday February 9, 2011 | Permalink
  9. silverlight001
    Member

    Hi,

    I'm still having problems with the validation even with the 1.5 beta release.

    It's a bit of an issue since a client is refusing to sign off a site until it passes the W3c validator and I've always prided myself on ensuring all my sites have correct markup.

    Please advise

    Thanks

    Posted 9 years ago on Saturday February 19, 2011 | Permalink
  10. I'm looking at your site again, and see that it's using the 1.4.5 release. Where did you try the beta?

    Posted 9 years ago on Saturday February 19, 2011 | Permalink
  11. silverlight001
    Member

    Hi,

    I tried the beta then checked the validation (that failed)

    I then realised the beta had broken the forms so had to quickly revert back to the previous version since this is a live site and can't have the client missing a "call-back" since they get a dozen or so a day

    Be grateful if you could point me to install instructions for the beta release just in case I missed anything,

    Thanks

    Posted 9 years ago on Sunday February 20, 2011 | Permalink
  12. The beta is stable - tons of people are using it without any issues right now. Not sure what you ran into unless it was a bad installation.

    That said, you simply download the zip to your desktop. Delete the current copy of Gravity Forms either via the plugin admin of via ftp, then either use the built-in WordPress installer to upload/activate the plugin or upload the unzipped files manually via ftp. It should be a straightforward installation.. just like any other plugin.

    Posted 9 years ago on Monday February 21, 2011 | Permalink
  13. 1.5 shouldn't break your forms, there are no known issues with installing 1.5 breaking forms. If 1.5 isn't working properly for you then please provide more details.

    We haven't had any other repots of issues so if there is an issue with using 1.5 on your site we would need to see the issue happening in order to be able to debug it because it could be an issue specific to your site.

    Please provide more details than "broke my forms". Does that mean 1.5 didn't install? The forms didn't load/appear? They appeared but weren't styled properly? You got a white screen? As much details as possible would be helpful because there aren't any known issues with upgrading to 1.5.

    Posted 9 years ago on Monday February 21, 2011 | Permalink
  14. silverlight001
    Member

    Hi Guys

    I have just installed it on another site and this fails the W3c seemingly due gravity forms?

    http://validator.w3.org/check?uri=http%3A%2F%2Fwww.titaniumconsulting.co.uk%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

    I will try it on the clients site again during the weekend when it is quieter

    Posted 9 years ago on Monday February 21, 2011 | Permalink
  15. @silverlight001 The issue is you are using Gravity Forms in a Widget. When Gravity Forms is used in a Widget it is unable to enqueue the necessary CSS and Javascript in the Head of your site because of how WordPress executes code. It's too late in the WordPress lifecycle to be able to enqueue the css/scripts into your HEAD.

    It's only option is to output it inline, UNLESS it already exists in the HEAD. Since the form is in your footer and is persistant what you can do is manually enqueue the necessary CSS and Javascript into our HEAD by adding the enqueue function call to your themes functions.php. This way your theme will enqueue the necessary CSS and Javascript before the form is called in the Widget. The Widget will detect that the CSS and Javascript already exists on the page and won't output it's own.

    In Gravity Forms v1.5 the way you can enqueue the necessary CSS and Javascript for a specific form is to call this function call in your themes functions.php file:

    <?php
    gravity_form_enqueue_scripts(101, true);
    ?>

    You would change out the 101 with the form id of the form that is in your footer and the 2nd parameter you would set to true if you want the form to use AJAX and false if you don't want it to use AJAX. This let's the function know if it should enqueue the AJAX script.

    The enqueue function is only in Gravity Forms v1.5, you have to enqueue scripts differently in previous versions of Gravity Forms.

    So add that function call to your themes functions.php file and the Widget will not output it inline. But it's a limitation of WordPress that the widget is unable to enqueue scripts.

    Also, I see you are running an older version of Gravity Forms v1.5, there is a new development release available on the Downloads page.

    Posted 9 years ago on Monday February 21, 2011 | Permalink
  16. silverlight001
    Member

    Hi I added this line into my funtions.php

    gravity_form_enqueue_scripts(1, true);

    but I got this message:

    Fatal error: Class 'GFCommon' not found in /vhost/vhost9/t/i/t/titaniumconsulting.co.uk/www/wp-content/plugins/gravityforms/gravityforms.php on line 1053

    All the text in my widgets (6 widgets in total) has also dissapeared arhh... somethings not right?

    Posted 9 years ago on Tuesday February 22, 2011 | Permalink
  17. @silverlight001 You can only do this on the site that is running the latest version of the Gravity Forms v1.5 development release. It doesn't exist in the v1.4.5 release.

    Posted 9 years ago on Tuesday February 22, 2011 | Permalink
  18. silverlight001
    Member

    Hi Carl

    On the site - titaniumconsulting.co.uk

    I have the following version of Gravity installed

    1.5.RC3.12

    Please advise, many thanks

    Posted 9 years ago on Wednesday February 23, 2011 | Permalink
  19. @silverlight001 The first thing you need to do is install and test with the latest development release. That is an older 1.5 release so upgrade to the latest release which you can download from the Downloads page.

    Posted 9 years ago on Wednesday February 23, 2011 | Permalink
  20. silverlight001
    Member

    Hi,

    I've tried this and I get an http500 error when I add the code to my functions file:

    http://www.pastie.org/1631718

    Please advise

    Thanks

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  21. Try adding it to the bottom of the functions.php rather than the top. It could be causing a problem with how Genesis executes it's functions.php and the order in which the code is in that file.

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  22. silverlight001
    Member

    Hi Carl,

    Thanks I will give it a try but I just had gravity plugin conflicts thta stopped the home page from loading - i think it's to do with the fact that in my plugins page I have two versions of the plugin - how can I tidy this up so that it just shows v.1.5rc4.2 please

    Gravity Forms Easily create web forms and manage form entries within the WordPress admin.

    Activate | Edit | Delete Version 1.5.RC3.12 | By rocketgenius | Visit plugin site
    Gravity Forms Easily create web forms and manage form entries within the WordPress admin.

    Deactivate | Edit Version 1.5.RC4.2 | By rocketgenius | Visit plugin site

    Thanks

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  23. silverlight001
    Member

    Hi,

    plugins tidied up and the code to the bottom of the functions file but still no luck http5-- internal server error:

    http://www.pastie.org/1633160

    please advise

    Thanks

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  24. Your plugin files are messed up then. The way plugins install you shouldn't be able to install the same plugin twice unless you manually uploaded plugin files to folders where they should not be. So you have something wrong with how you have uploaded the plugins.

    I would suggest completely removing all Gravity Forms plugin files. Make sure no versions are listed on your plugins page. Then upload a fresh install of 1.5 RC4.2 and activate it. You've uploaded files where they shouldn't be which is why this issue is happening.

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  25. silverlight001
    Member

    This is the correct code I added to the site:

    http://www.pastie.org/1633165

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  26. @silverlight001 Good to know, we will keep that in mind for other users using Genesis. In most themes it doesn't matter, but the Genesis framework is executing code in it's functions.php in a certain order so the order does matter. Glad that worked.

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  27. silverlight001
    Member

    Hi Carl,

    deactivated all gravity plugins, deleted the files - then re-installed 1.5 RC4.2.

    Uploaded functions file with gravity_form_enqueue_scripts(1, true);

    Still htpp error 500

    Please advise

    Thanks

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  28. silverlight001
    Member

    please let me know if you want me to post this issue into studiopress forums since I still have http500 with this code in the functions file

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  29. @silverlight001 Can you provide us a WordPress admin login and FTP information for this site? What we can do is look at your theme, functions.php file and see what is going on. That will allow us to resolve this quicker than going back and forth on the forum. If you can send us this information via our Contact Us form and reference this forum post we can take a look.

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  30. silverlight001
    Member

    Hi Carl, details sent to you, thanks

    Posted 9 years ago on Friday March 4, 2011 | Permalink
  31. silverlight001
    Member

    Hi,

    Still getting an HTML validation error even with the latest version of gravity forms

    Line 215, Column 299: document type does not allow element "link" here
    …nt/plugins/gravityforms/css/forms.css?ver=3.0.4' type='text/css' media='all' />
    site=http://www.titaniumconsulting.co.uk/

    Posted 9 years ago on Tuesday April 5, 2011 | Permalink
  32. I'm assuming you're using the form widget and if so, it's not going to validate because of the stylesheet link outside of the head element.

    If you're concerned about validation, you can go to the widget admin, select the form widget and check the "disable script output" option. This will remove the script/css reference.

    http://grab.by/9OpC

    You will then need to manually enqueue the scripts/css on your page so everything functions and displays properly.

    http://www.gravityhelp.com/documentation/page/Embedding_A_Form

    Posted 9 years ago on Tuesday April 5, 2011 | Permalink
  33. silverlight001
    Member

    Hi Kevin,

    It was mentioned that these problem were fixed in the latest release but it appears not?

    Also, the last time you guys added an enqueue function to my site it broke it during the upgrade and I spent several hours resolving the white screen of death issue

    http://www.gravityhelp.com/forums/topic/gravity-15-white-screen-of-death

    I think the problem needs a proper, sustainable fix please?

    Thanks

    Posted 9 years ago on Thursday April 7, 2011 | Permalink
  34. @silverlight001 Kevin already explained that to fix this issue you need to enqueue the scripts by adding the enqueue function to your functions.php. We made changes to the enqueue function in the new release so it should work.

    The "fix" had nothing to do with making the Widget so it doesn't output script/css. The only way to avoid that is to use the enqueue function in your functions.php file.

    There is NO way to fix the Widget so that it automatically enqueues the script in the head/foot because Widgets execute too late in the WordPress execution life cycle to be able to do so. So if it isn't manually enqueued using the function call the Widget has no other choice but to output the script and CSS calls in line. This has explained a couple different times already in this thread.

    The issue you ran into was unavoidable as far as a sustainable fix goes. There are hundreds of themes out there, we can't take all of them into account and a lot of them work differently. So in situations like that if there is something on our end we can change to make it work better, we do. Your issue was a theme specific issue with how Genesis executes, so it was unavoidable.

    We do our best to make sure Gravity Forms works as intended out of the box, but with literally thousands of themes and thousands of plugins, issues like the one you encountered with the enqueue function is unavoidable.

    Posted 9 years ago on Thursday April 7, 2011 | Permalink
  35. silverlight001
    Member

    OK Carl I'll try and add the enqueue

    but when you guys logged onto my site to add the enqueue function last time it caused the white screen of death when I upgraded to Gravity v1.5 and took a lot of hassle to eventually work out that it was that manual fix that caused the issue e.g. you first said it was memory issues etc...

    http://www.gravityhelp.com/forums/topic/gravity-15-white-screen-of-death

    My point is that the manual fix to enqueue needs to be sustainable with the release of new versions etc..

    Posted 9 years ago on Friday April 8, 2011 | Permalink
  36. @silverlight001 Like I said above, we fixed that enqueue function issue. The issue was on the Genesis side, and we implemented a work around for that. We can do our best to limit issues like this, but as I mentioned we can't guarantee it's going to work 100% with all themes or plugins because of the fact we have no control over what other themes and plugins do and because of the nature of PHP it's not 100% preventable. But we do our best to resolve them as issues come up.

    Posted 9 years ago on Friday April 8, 2011 | Permalink