PDA

View Full Version : How do I make this line validate in xhtml?



diesel12
Aug 11th, 2007, 06:49 PM
I'm having trouble validating this is xhtml transitional:

<textarea name="txtComments" cols="18" rows="3" class="contact_form_comment"
onfocus="if(this.value=='Comments')this.value='';" onblur="if(this.value=='')this.value='Comments'" value= "Comments" >Comments</textarea>

The error:

Line 155, column 107: there is no attribute "value"

…ue=='')this.value='Comments'" value= "Comments" >Comments</textarea></td>

I have similar lines in this form but they are not a textarea, but an input and they have no problems... tried changing this to input (this is a text input "comments" box in inquiry form) but couldn't get it so that text would wrap at end of input box and go to next line, it would all stay on first line instead of wrapping to 2nd, 3rd, 4th columns etc....

Any help or feedback is appreciated!

BWiz
Aug 11th, 2007, 06:51 PM
The <textarea> element doesn't require a value attribute; it's value is set in between the <textarea></textarea> tags.

VIPStephan
Aug 11th, 2007, 06:52 PM
Well, I think the validator makes pretty clear that text areas don’t have an attribute called value. Just remove it. You already have the comment text between the opening and closing tags which will be displayed in the textarea then.

diesel12
Aug 11th, 2007, 06:58 PM
thanks guys, that worked.... I'm valdating pages for the first time so I've come a long way in the last day, but sometimes I don't understand the messages.... at first I thought there was a issue with it being upper case .... if only it were as easy as just deleting areas that have an issue every time. :)

Len Whistler
Aug 11th, 2007, 10:15 PM
if only it were as easy as just deleting areas that have an issue every time. :)


Pick the "Clean up Markup with HTML Tidy" option when you revalidate, the options are close to the top of the page with your results. You will then get an output with most - if not all - of the errors cleaned up. Sometimes the new code will change the layout, like centered items are now to the left, but those will be easy to fix.