[albatross-users] al-form, __albform__, and XHTML validation
Paul Hart
paulhart at redchocolate.ca
Sat Oct 11 07:31:21 EST 2003
Hi all,
I'm developing a web application, and one of the requirements is that
the app must be XHTML 1.1 compliant.
I've downloaded and installed Albatross 1.11pre2, and that has helped
to fix a few of the problems I've seen before (I was running 1.10
previously).
Currently there is a single issue remaining. Albatross apparently
requires the automagically created __albform__ hidden input field to
make it work correctly. The problem is that XHTML requires a container
tag (one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p",
"div", "address", or "fieldset") between the form tags and the input
tags.
For example, this would be valid:
<form action="login" method="post">
<div>
Email Address: <input type="text" name="email_address"/><br/>
Password: <input type="password" name="password"/>
</div>
<div>
<input type="hidden" name="__albform__" value="..." />
<div>
</form>
But what we get right now is:
<form action="login" method="post">
<div>
Email Address: <input type="text" name="email_address"/><br/>
Password: <input type="password" name="password"/>
</div>
<input type="hidden" name="__albform__" value="..." />
</form>
And that is invalid XHTML 1.1.
The quick fix is to alter the code that builds the __albform__ tag to
enclose it in a div that is hidden. In context.py, the code would be:
self.write_content('<div style="display: none;"><input
type="hidden" name="__albform__" value="')
self.write_content(text)
self.write_content('" /></div>\n')
The code is such that the div will not be displayed in any browser, and
so the effect is hidden. Of course, that's just my attempt at fixing
this, if anyone has any better suggestions, I'd love to hear them :)
Thanks,
Paul Hart
More information about the Albatross-users
mailing list