0

I am having some more validation issues I have just added a search box to my page i did have it as xhtml strict and it was validating fine once i added this for it produced 50 errors then i changed the doc type to transitional now there are are only two errors it is saying there in no such attribute as onblur or onfocus??

I would really like to keep this as strict but when i keep it as strict there are three errors the two mentioned above and i also says that target="_self" is an invalid attribute.

Any ideas how i can fix this?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>APA</title>
<link rel="stylesheet" type="text/css" href="css/main.css" />
<link rel="stylesheet" type="text/css" href="css/topmenu.css" />
<link rel="stylesheet" type="text/css" href="css/leftmenu.css" />
</head>
<body>

<div id="holder">

<div id="header">

<form action="./search.php" method="get" target="_self">
<table class="search">
<tr><td>
<input type="hidden" value="SEARCH" name="action" />
<input type="hidden" value="en" name="lan" />
<input type="text" name="keyword" class="text" size="12" maxlength="30" value="" onFocus=" if (value == '') {value=''}" onBlur="if (value == '') {value=''}" /></td>
<td><input type="hidden" value="50" name="limit" />
<input type="submit" value="Search" class="button" />
<input type="hidden" value="" name="case" />
<input type="hidden" value="1" name="extracts" />
<input type="hidden" value="25" name="perpage" />
</td></tr>
</table> 
</form>

</div>
4
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by MidiMagic
0

javascript statements end in ' ; '
strict means you have to complete your javascripts,

<input type="text" name="keyword" class="text" size="12" maxlength="30" value="" onFocus=" if (value == '') {value='';}" onBlur="if (value == '') {value='';}" /></td>

not sure if it isnt supposed to be

<input type="text" name="keyword" class="text" size="12" maxlength="30" value="" onFocus=" if (self.value== '') {self.value='';}" onBlur="if (self.value == '') {self.value='';}" /></td>

coz I dont write strict, still in html 4.01 trans,
or is it

<input type="text" name="keyword" class="text" size="12" maxlength="30" value="" onFocus="JAVASCRIPT:if (self.value== '') {self.value='';}" onBlur="JAVASCRIPT:if (self.value == '') {self.value='';}" /></td>

I have no idea
my javascript sux, incidentally so must yours,
else why 'If this field is blank set this field to blank' (twice)

target='_self' forms take action='self' w3.org-forms
self is redundant,
can be written as action='<?php echo $_SERVER['PHP_SELF']; ?>' (in php) and is equally redundant <form action=""> will get it back here

0

run the page at validator.w3.org..... and you can find out the code that has to be edited.. the comments provided are self explanatory.....

0

-onFocus onBlur
onfocus onblur are lower case keywords in xhtml

At least now I am certain, my javascript is terrible,

please what does setting the field blank if it is blank on mouseover mouseout accomplish

0

thanks almostbob your last comment was perfect onfocus onblur have to be lower case. Yes you are right about my javascript it sucks I hate javascript. The php comment about using php_self well i thought about that before but action has to call search.php anyway thanks for that my page is validating 100% now

0

-please what does setting the field blank if it is blank on mouseover mouseout accomplish

my teenager just told me
the script is probably using the onblur onfocus to validate the inputs, but you clipped them before displaying here
he said I should know that
:icon_redface:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.