button html code doesn't validate at all with W3C ??

al-ainau
Contributor
Contributor

Hi,

i just downloaded and installed a "buy" button. Once i included the provided html code within the web page, i checked it with W3C, and bingo ! 18 errors.  Mind you, i did check prior to the impletation of the button code, and it did validate, so the problem is the PayPal html code, which surprises quite a bit. I was not expecting that type of issue from product provided by payPal....I am coding in XHTML 1.0 Strict, encoding utf-8.

 

Is there an html  code more recent, that would indeed validate with the W3C ??

Thanks

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

PayPal_Frank
Administrator
Administrator

Hi al-ainau,

 

Welcome to the community! 

 

PayPal does not currently offer button code that validates under XHTML Strict but I know some merchants have chosen to modify the code so that it does validate.

 

I was able to make some changes to get a hosted add to cart button to validate under XHTML 1.0 strict.

- Removing the "target" and "border" attributes

- Making sure that all elements have a <.../> if they dont' have a separate closing tag

- Adding <p></p> to get rid of nesting element errors.

 

<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<title>Test page</title>
</head>
<body>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="hosted_button_id" value="hosted_button_id_value"/>
</p>
<table>
<tr><td><input type="hidden" name="on0" value="Name of drop-down menu"/>Name of drop-down menu</td></tr><tr><td><select name="os0">
	<option value="Option 1">Option 1 $0.01</option>
	<option value="Option 2">Option 2 $0.02</option>
	<option value="Option 3">Option 3 $0.03</option>
</select> </td></tr>
</table>
<p>
<input type="hidden" name="currency_code" value="USD"/>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
</p>
</form>
</body>
</html>

 

 I hope this example helps to modify your own code to validate. 😄

 

- Frank

If you see a helpful post, please accept it as a solution or give the author kudos. 🙂 Thanks!

View solution in original post

Login to Me Too
2 REPLIES 2
Solved

PayPal_Frank
Administrator
Administrator

Hi al-ainau,

 

Welcome to the community! 

 

PayPal does not currently offer button code that validates under XHTML Strict but I know some merchants have chosen to modify the code so that it does validate.

 

I was able to make some changes to get a hosted add to cart button to validate under XHTML 1.0 strict.

- Removing the "target" and "border" attributes

- Making sure that all elements have a <.../> if they dont' have a separate closing tag

- Adding <p></p> to get rid of nesting element errors.

 

<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<title>Test page</title>
</head>
<body>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="hosted_button_id" value="hosted_button_id_value"/>
</p>
<table>
<tr><td><input type="hidden" name="on0" value="Name of drop-down menu"/>Name of drop-down menu</td></tr><tr><td><select name="os0">
	<option value="Option 1">Option 1 $0.01</option>
	<option value="Option 2">Option 2 $0.02</option>
	<option value="Option 3">Option 3 $0.03</option>
</select> </td></tr>
</table>
<p>
<input type="hidden" name="currency_code" value="USD"/>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
</p>
</form>
</body>
</html>

 

 I hope this example helps to modify your own code to validate. 😄

 

- Frank

If you see a helpful post, please accept it as a solution or give the author kudos. 🙂 Thanks!
Login to Me Too

al-ainau
Contributor
Contributor

Hi Frank,

  Super, many thanks.

I did edit as suggested, and it now validates with W3C.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.