durusmail: quixote-users: Re: single word attributes in html.htmltag()
Unicode support for Quixote 2
2004-09-03
2004-09-03
2004-09-03
2004-09-03
Quixote / mod_python - test workflow?
2004-09-04
Re: R: [Quixote-users] Quixote / mod_python - test workflow?
single word attributes in html.htmltag()
2004-09-05
Re: single word attributes in html.htmltag()
2004-09-06
2004-09-04
2004-09-08
Python Best of Breed web app snippets / small webapps
2004-09-08
2004-09-10
2004-09-09
2004-09-09
2004-09-09
2004-09-09
Re: single word attributes in html.htmltag()
Graham Fawcett
2004-09-06
Charles Brandt wrote:
> Hello,
>
> I'm wondering if there is an existing way to set a single word attribute
> (for lack of a better description) in an htmltag.  My specific need for this
> is in the form2 package, I'd like to set a CheckboxWidget as "disabled"
> (under certain circumstances).

I might be missing something, since I don't use the form2 package. But,
generally speaking, the form

     

is equivalent to

     

Where "1" can be replaced with some other dummy value.

Note that if you're using XHTML, or any XML variant, you *must* use this
form, because XML doesn't support attributes without values.

You could have code like

     my_bool = is_currently_checked()
     some_tag('input', type='checkbox', checked=my_bool)

If my_bool is True, let some_tag output checked="1". Else, don't output
"checked" at all...

Hope this helps,

-- Graham


reply