Forum Moderators: open

Message Too Old, No Replies

Link to me form doesn't validate

Won't accept the link

         

Lorel

4:05 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I set up a form to allow people to copy a link so they can link to a page easily but the validator indicates that the link text is in error. Can anyone see anything wrong with this?

<form action="noaction" name="linktext">
<textarea name="link" cols="38" rows="4">
<a href="http://www.DOMAIN.com/KeywordGoesHere.html">Keyword Text Goes Here.
</textarea></form>

tedster

4:51 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is no </a> tag

Lorel

9:46 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sorry, my goof. when I was falcifying the url I must have wiped out the </a> but it's in the original. Here is the corrected form data:

<form action="noaction" name="linktext">
<textarea name="link" cols="38" rows="4">
<a href="http://www.DOMAIN.com/KeywordGoesHere.html">Keyword Text Goes Here.</a>
</textarea></form>

When I run it through the w3c validator I get this error:

document type does not allow element "A" here and it was pointing to the caret just before where the link text goes.

encyclo

9:55 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't have a link within a textarea, which is why it fails validation. But, as I understand it, you hant the person to be able to copy/paste the link markup rather than have an active link. In that case, just escape the brackets:

<form action="noaction" name="linktext">
<textarea name="link" cols="38" rows="4">
&lt;a href="http://www.DOMAIN.com/KeywordGoesHere.html"&gt;Keyword Text Goes Here.&lt;/a&gt;
</textarea></form>

mcibor

10:10 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



However if you want the user to go to the specified url by clicking at the link then I don't recommend using text area there.

The forced method that would validate would be placing onclick:

<form action="noaction" name="linktext">
<textarea name="link" cols="38" rows="4" onclick="parent.location.href='http://www.DOMAIN.com/KeywordGoesHere.html';">
Keyword Text Goes Here.</textarea></form>

However this is not a proper way to do it.

Lorel

4:57 pm on Jan 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



"You can't have a link within a textarea, "

Ahhh. that explains it.

thanks