1 (edited by MattF 2007-09-23 12:53)

Topic: XML, tables and input fields

Run into one minor, snag whilst I'm setting things up as Xhtml/XML proper. Gallery script doesn't use valid syntax, (knowingly), for tables:

<td>
  <a href=[path to image]>[image thumbnail]</a>
  <input type=text[contains selectable image link 1]>
  <input type=text[contains selectable image link 2]> 
</td>

It's the input part. I did it that way for aesthetics and ease, (and also just because it worked), big_smile but obviously now the scripts are being properly parsed, it's just throwing an error. Is there a viable alternative for achieving the above type of setup, and making it correct, syntax wise, in the process?


Cheers,

Matt

Re: XML, tables and input fields

Show us the full page source and error?

3 (edited by MattF 2007-09-23 15:16)

Re: XML, tables and input fields

elbekko wrote:

Show us the full page source and error?

Was just about to pop it up, and then twigged why the XML parsing was failing. (The error message pointed to a completely different spot on the line than where the problem lay). big_smile I'd used normal <> for an img code line instead of &lt: and >. This xml thing does make you triple check your code, doesn't it? big_smile The way this is going, I doubt this'll be the last question I'm asking today though. big_smile Cheers Elbekko. smile

Edit: I'll expand on that further just incase anyone has this problem in the future. Inside the input field, I'm supplying the <img code for inclusion in posts, as such:

$getimg = '<img src='.$image.' alt='.$filename.'/>';

echo ("<br /><input name=\"img\" type=\"text\" value=\"".$getimg."\" onclick=\"highlight(this);\" />");

The problem lay with that $getimg var. It needed formatting as below:

$getimg = '<img src='.$image.' alt='.$filename.'/>';

4

Re: XML, tables and input fields

Just out of further curiosity, I originally thought this problem was due to their being an input field inside the table data field, as previously when I put that code through the parser/validator, it said that <input couldn't appear with <td, according to Xhtml specs. Was that a glitch with the validator? It now doesn't put that info up when I run the html validator over that page.

5

Re: XML, tables and input fields

Nothing wrong with an input inside a td. Could it have been that the validator was reading > as the end of the input tag before getting to the /> and therefore it appeared the tag was not closed properly.

In other words, its saying <input> cannot appear in a td but <input /> can.

6 (edited by MattF 2007-09-23 16:18)

Re: XML, tables and input fields

Cheers Paul. It may well have been that tag causing that previous issue, judging by your description. I have had a few occasions when testing the html code where the validator has displaced an error due to an earlier syntax error. The scenario where curing one error sorts all the phantome errors too. big_smile Whilst I'm going through the code, btw, am I better off using numeric entities rather than the character ones, for the sake of future proofing as much as possible? Using < instead of < and so forth?

Cheers again,

Matt

7

Re: XML, tables and input fields

I'm using numeric entities exclusively in PunBB 1.3. There are 6 (or is it 5) character entities that can safetly be used cross browser but I just find it more consistent to always use the numeric entities.

8

Re: XML, tables and input fields

Cheers for that advice. smile Just finished going through the scripts and replacing everything with it's numeric counterpart.


Thanks again,

Matt