Re: Empty attributes in form tags
"Jonathan Ellis" <[email protected]> Wed, 05 Dec 2007 11:06:08 -0800
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 5 Dec 2007 09:16:13 +0100, "Konrad Mauz" <kmauz-5HlQSm0/[email protected]> said: > Hi all, > > I'm looking for a simple way to switch input fields from > readwrite to readonly. The readonly attribute for <input ...> tags > is an attribute without value. > > The following code does not work: > > --- schnipp --- > [[\ > computername = "mycomp" > if ( mySwitch ): > ro="readonly" > else: > ro="" > ]] > > <f:text name="cname" value="=computername" ="=ro" /> Nope, that won't work. Spyce tags can't syntactically handle valueless parameters. Really the best solution is to patch the input tag (that text inherits from) in tags/form.py to handle readonly (and disabled) attributes properly. (i.e., take a boolean value as a tag parameter, but emit the correct html.) -Jonathan ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4