Forum Moderators: open

Message Too Old, No Replies

Validation error on a form

Error X :: What's all that about then?

         

Nick_W

4:31 pm on Jul 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



* Line 65, column 31:

<p><label for="msg">Details:</label><br />
^

Error: X

Hmmmm.... there's nothing wrong with the code that I can see....
:
Cheers

Nick

Knowles

4:33 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



It just dont like you Nick ;)

Your <p> is not ended but I figure thats probably one another line right?

Nick_W

4:47 pm on Jul 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure is:

<fieldset>
<legend>Your message</legend>
<p><label for="msg">Details:</label><br />
<textarea cols="30" name="msg" rows="10"></textarea></p>
</fieldset>

Nick

Knowles

4:49 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



I knew it was but thought I would make sure, seeing how it is I go back to my first response. I dont see a single thing wrong with that line or any of the ones around it to cause it to kick back like that.

bobriggs

5:16 pm on Jul 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<textarea cols="30" name="msg" rows="10" id="msg">

should fix it.

Knowles

5:18 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



bobriggs, please explain? Why would that trigger the error to be on the line above the one the error is actually in?

Nick_W

5:19 pm on Jul 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Okay, spill it bob!

Why the hell does that work?

...oh, and thanks!

Nick

Knowles

5:26 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



Did it work?

bobriggs

5:26 pm on Jul 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[w3.org...]

there was no id element

When present, the value of this attribute must be the same as the value of the id attribute of some other control in the same document.

It couldn't point to any other line.

Knowles

5:27 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



Gonna read W3C on vacation I swear! Everytime I feel like I am catching up I fall behind!

Nick_W

5:31 pm on Jul 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm still lost but thanks...

Nick

Knowles

5:33 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



Did you read the page Nick? When you have for="msg" in your label you have to id the text box to go with msg.

for = idref [CS]
This attribute explicitly associates the label being defined with another control. When present, the value of this attribute must be the same as the value of the id attribute of some other control in the same document. When absent, the label being defined is associated with the element's contents.

This is what bobriggs had quoted but he only took part of it.

But now my question is it says when its absent the label is defined by the associated element's contents so why does the last code kick and error? Or am I reading it wrong and it saying when FOR is absent not ID?

bobriggs

5:45 pm on Jul 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



read further..

<LABEL>
First Name
<INPUT type="text" name="firstname">
</LABEL>

The content of the label is now First Name, so the input must come withing <label></label>

When the validator saw 'for', it tried to find an id somewhere else in the document. That id could have been on any line (ie, it didn't know which control you meant - assuming there are more controls) So it had to point to that line. The problem is 'Error: X' - should have given a better explanation.

Nick_W

6:04 pm on Jul 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Goddamit!

I know about labels and id's that's why I'm using them! Sorry guys, just missing the obvious I guess....

Nick