Forum Moderators: open

Message Too Old, No Replies

Validation Question

         

spyder_tek

1:51 am on Mar 10, 2006 (gmt 0)

10+ Year Member



I'm trying to re-design my site so that it validates for XHTML 1.0 Strict.

When I test my site using the validation service at W3.org, it says...

All of my image tags must contain an alt attribute, and that all form tags must contain an action.

The problem I'm facing, is that I don't want some images to contain alt attributes, and some form tags to have an action.

I was able to solve the validation problem by giving these tags empty values, such as:

alt=""

&

action=""

However, I don't like doing it this way. Is there another way around this?

Thanks.

tedster

2:21 am on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is the recommended practice - and I don't know of another.

DrDoc

5:09 am on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I actually think that's quite a good solution. It ensures that you are leaving them blank on purpose, not by mistake. By being forced to define them, you are less likely to make mistakes resulting from omitting the attributes.

Robin_reala

7:23 am on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, DrDoc's got it right. By saying alt="" you're telling the user agent that "I know all images should have a description, but I think this one is presentational and doesn't warrent it". The action="" is a little more worrying - how is your form going to submit if it doesn't know where it's going to submit to?

spyder_tek

6:26 pm on Mar 11, 2006 (gmt 0)

10+ Year Member



Thanks guys. I guess I'll just use empty values then. ;)

Robin_reala >

Well, I have some textarea fields that need to be enclosed by the <form></form> tags.

I also have some javascript functions that are initialized using onSubmit, such as:


<form onSubmit="return function()">
<input type="submit" value="Submit">
</form>

So I have to specify empty action values (unless there's some other solution).