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.

Validating using Query String

  1. rsigg
    Member

    Hello,
    I am getting errors on the W3C validator for not encoding my entire query string.

    Here's an example of my url and the errors:
    http://mydomain.com/request-information/?itin=Small+Ship+Cruise&line=Cruise+Line

    Error: "General entity "line" not defined and no default entity. This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text."
    As you can see in the string, I have encoded the rest of the string.
    However I replace '&line' with '&line' then the field does not dynamically populate at all. The 'itin' field still populates correctly.

    I feel like I must be doing something really stupid since I can't find any topics on the forums or the GoogleMachine...

    Help please...
    Thanks in advance.

    Posted 12 years ago on Monday June 27, 2011 | Permalink
  2. rsigg
    Member

    Sorry, I meant up there that:
    I replace '&line' with the 'entityline' (this box won't let me put the entity for &, even if I put it in backticks.

    Posted 12 years ago on Friday July 1, 2011 | Permalink
  3. What settings and version are you using for W3C validation? XHTML Strict? XHTML Transitional? HTML 5? There are a variety and each different.

    Also, any validation isn't a strict rule, it's a guideline. Your site isn't broken if it doesn't validate. All browsers are going to handle that URL just fine. It's not going to pose a technical issue or a user issue if that page doesn't validate because of the URL.

    Posted 12 years ago on Friday July 1, 2011 | Permalink
  4. rsigg
    Member

    I understand that my site isn't broken and that validation is a guideline.

    However, I find it very strange that if I pass my form an encoded URL it will parse a string like "Test+String" correctly as "Test String" but will not decode an encoded ampersand.

    Posted 12 years ago on Saturday July 9, 2011 | Permalink
  5. I am using '& amp;' (without the space inbetween ofcourse) in the pre-populate URLs without issues.

    Posted 12 years ago on Sunday July 10, 2011 | Permalink
  6. rsigg
    Member

    Are you using this dynamically populate a field via the query string?
    I'm using mine to populate a hidden field, and nothing shows if I encode the ampersand.

    Posted 12 years ago on Sunday July 10, 2011 | Permalink