close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

HTML W3C Validation kicks out validation error related to "&"

Thread began 3/22/2013 2:57 pm by Andrew Read | Last modified 3/22/2013 4:11 pm by Jason Byrnes | 3722 views | 8 replies |

Andrew Read

HTML W3C Validation kicks out validation error related to "&"

I am running some validation tests on a new site that I am working on and validating against HTML5 kicks the following errors, should these ampersands all be "&amp"?

Thank you.

  1. Line 245, Column 118: & did not start a character reference. (& probably should have been escaped as &.) …vt_captchasecurityimages.php?width=225&height=75&field=Security_Code&bgcolor=7… ✉
  2. Line 245, Column 128: & did not start a character reference. (& probably should have been escaped as &.) …securityimages.php?width=225&height=75&field=Security_Code&bgcolor=776415&tran… ✉
  3. Line 245, Column 148: & did not start a character reference. (& probably should have been escaped as &.) …idth=225&height=75&field=Security_Code&bgcolor=776415&transparent=0&bgimage=&g… ✉
  4. Line 245, Column 163: & did not start a character reference. (& probably should have been escaped as &.) …=75&field=Security_Code&bgcolor=776415&transparent=0&bgimage=&gridfreq=50&grid… ✉
  5. Line 245, Column 177: & did not start a character reference. (& probably should have been escaped as &.) …rity_Code&bgcolor=776415&transparent=0&bgimage=&gridfreq=50&gridcolor=CC2849&g… ✉
  6. Line 245, Column 186: & did not start a character reference. (& probably should have been escaped as &.) …&bgcolor=776415&transparent=0&bgimage=&gridfreq=50&gridcolor=CC2849&gridorder=… ✉
  7. Line 245, Column 198: & did not start a character reference. (& probably should have been escaped as &.) …415&transparent=0&bgimage=&gridfreq=50&gridcolor=CC2849&gridorder=behind&noise… ✉
  8. Line 245, Column 215: & did not start a character reference. (& probably should have been escaped as &.) …&bgimage=&gridfreq=50&gridcolor=CC2849&gridorder=behind&noisefreq=10&noisecolo… ✉
  9. Line 245, Column 232: & did not start a character reference. (& probably should have been escaped as &.) …q=50&gridcolor=CC2849&gridorder=behind&noisefreq=10&noisecolor=0099FF&noiseord… ✉
  10. Line 245, Column 245: & did not start a character reference. (& probably should have been escaped as &.) …r=CC2849&gridorder=behind&noisefreq=10&noisecolor=0099FF&noiseorder=behind&cha… ✉
  11. Line 245, Column 263: & did not start a character reference. (& probably should have been escaped as &.) …=behind&noisefreq=10&noisecolor=0099FF&noiseorder=behind&characters=5&charheig… ✉
  12. Line 245, Column 281: & did not start a character reference. (& probably should have been escaped as &.) …10&noisecolor=0099FF&noiseorder=behind&characters=5&charheight=&font=fonts/MYT… ✉
  13. Line 245, Column 294: & did not start a character reference. (& probably should have been escaped as &.) …=0099FF&noiseorder=behind&characters=5&charheight=&font=fonts/MYTYPE.TTF&textc… ✉
  14. Line 245, Column 306: & did not start a character reference. (& probably should have been escaped as &.) …eorder=behind&characters=5&charheight=&font=fonts/MYTYPE.TTF&textcolor=E4D4AA"… ✉
  15. Line 245, Column 328: & did not start a character reference. (& probably should have been escaped as &.) …rs=5&charheight=&font=fonts/MYTYPE.TTF&textcolor=E4D4AA" alt="security code" w… ✉
  16. Line 245, Column 501: & did not start a character reference. (& probably should have been escaped as &amp;.) …ng" height="18" onClick="document.getElementById('capt1').src+='&ref=1'"></div> &#9993;
  17. Line 245, Column 509: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images. …ng" height="18" onClick="document.getElementById('capt1').src+='&ref=1'"></div>

Sign in to reply to this post

Jason ByrnesWebAssist

W3c validation on ampersands is tricky, the W3c doctype prefers the "&amp;" html entity to be used in query string variables, but in many cases, it causes the links to fail to work properly

Sign in to reply to this post

Andrew Read

Hi Jason,

I just changed these all to ampersands in order to see if the scripts still all worked, and they do. Would it be possible for Design Extender to make these all ampersands automatically so that I don't have to change every one on each form page individually? ;)

Also note another interesting validation error:

  
Line 245, Column 574: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images. …height="18" onClick="document.getElementById('capt1').src+='&amp;ref=1'"></div>  



This is only interesting because there is already an alt tag there (alt="security code") and if I add another validation tells me there is two. but with one it kicks the error. Odd.

Sign in to reply to this post

Andrew Read

Figured the alt text issue out, the referesh button doesn't have an alt code.

Sign in to reply to this post

Jason ByrnesWebAssist

the problem with ampersands is that encoding them does not work all the time.

it passes w3c validation, but does not work on all servers.

I have had many times where I tried to be W3C Compliant with links and encode the the ampersands only to have my links not work, it's really a 50 / 50 crap shot on whether encoding the ampersands will work or not.

Sign in to reply to this post

Andrew Read

What about using the URL-encoded value: %26?

  If you want to use an ampersand as a value inside the query string of a url (and not as a delimiter for separating arguments), then you should use the URL-encoded value: %26

how-use-amersands-html-encode/  
Sign in to reply to this post

Jason ByrnesWebAssist

that is only used if you want to include a literal & in the url.

Sign in to reply to this post

Andrew Read

Is it not a literal ampersand when it is used in joining the url elements (&rel=1) ?

Also, did you note the issue with the alt text for the refresh button not being created for the captcha refresh?

Sign in to reply to this post

Jason ByrnesWebAssist

no, that is not a literal ampersand, it is a separating character in that instance.

you use the % escaped version if you want a variable value to contain a literal ampersand:


&rel=1&q=rock%26roll


in this example the & character separates each variable, rel and q. the value for the q variable is rock&roll. the ampersand is used to separate variables so to prevent roll from becoming a variable name rather than a part of the string, you use the % escaped version.

i will log a bug for the issue with the refresh button.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...