Dymond
Dymond

Reputation: 2277

W3 Validation of HTML form

When im trying to validate my page on http://validator.w3.org/ i get one error that says

Line 118, Column 44: there is no attribute "onClick"

But when I change the onClick to just onclick i get about 40 new errors and almous al of them is complaining about the character, they want me to change the caracters to the HTML format, but If i do that my PHP script stop working.

This is one of the rows that the validator is complaning about after I change onClick to onclick

<input type="text" name="enterprise" id="enterprise" value="<?php echo isset($_POST['enterprise']) ? $_POST['enterprise'] : '' ?>" />

and this is my onclick string

<input type="button" value="Clear" onclick="window.location.reload();return false" />

Is there another way I can reload the page or how can I write the input type php scrip so it validates.

Thanks in advance

Upvotes: 0

Views: 380

Answers (2)

Racooon
Racooon

Reputation: 1496

There is 3 Method to do it with Html/JS,

<input type="button" value="Reload" onClick="window.location.reload()"/>
<input type="button" value="Reload" onClick="history.go(0)"/>
<input type="button" value="Reload" onClick="window.location.href=window.location.href"/>

Notice: You can use AJAX technology to refresh page without reloading all elements like images, css files...etc.

Upvotes: 0

Daniel
Daniel

Reputation: 1341

the W3 validator will complain if it finds any language it doesn't recognize and it's not normal in a webpage, such as php. You should pass your page trough a php server and then copy the final HTML in the validator.

Upvotes: 4

Related Questions