|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
XHTML input value cannot contain tags?
I have a validation issue with a site I'm working on converting from html to xhtml 1.0.
<input name="music" type="text" size="35" class="textfield" value="rage against the machine <a href='link.php?linkID=17' title='amazon.com' target='_blank'>[Amazon.com]</a>" /> It gives me these 2 lovely errors: 1) character "<" is the first character of a delimiter but occurred as data ...against the machine <a href='link.php?linkID=17' title='amaz If you wish to include the "<" character in your output, you should escape it as "<". Another possibility is that you forgot to close quotes in a previous tag. 2) character "<" is the first character of a delimiter but occurred as data ...zon.com' target='_blank'>[Amazon.com]</a>" /> if these are changed into <'s and gt's they won't work when they are pulled from the db and rendered to the client. It'l just show up as the tag, not as a link. Any ideas on how to get around this? |
|
#2
|
||||
|
||||
|
In order for your input tag to validate, you will need to replace the < and > characters with their HTML entities.
Code:
<input name="music" type="text" size="35" class="textfield" value="rage against the machine <a href='link.php?linkID=17' title='amazon.com' target='_blank'>[Amazon.com]</a>" /> Perhaps keep it stored in the database the way you have it, with < and >... Write a function to convert those characters to < and > Perhaps regular expressions will help. |
|
#3
|
|||
|
|||
|
Yeah thats what I ended up doing. Unfortunately, this seems to be the only real possible 'fix'.
|
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Advanced Web Development > XHTML input value cannot contain tags? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|