Re: Empty attributes in form tags

Christopher Clarke <cclarke-wYfHrJ5eQDBWk0Htik3J/[email protected]> Wed, 5 Dec 2007 09:46:32 -0400
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
I have not have much success with passing extra args to tags in  
string like you are trying to do here.
   In my case was some javascript stuff
So i just wrote a my own tag

[[.begin name=read_only singleton=True]]
     [[.attr name=ro default=1]]

[[if ro=='1': {]]
    <f:text name=funky readonly />
[[}]]
[[else:{]]
    <f:text name=funky />
[[}]]

[[.end]]

Hope this helps
Regards
Chris

On Dec 5, 2007, at 4:16 AM, Konrad Mauz wrote:

> 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" />
> --- schnapp ---
>
> If mySwitch is True this should render to:
>
> <input type="text" name="cname" value="mycomp" readonly />
>
> if mySwitch is False this should render to:
>
> <input type="text" name="cname" value="mycomp" />
>
> How can I insert valueless attributes in form tags without using
> if, elif, else? Is it possible?
>
> Regards Konrad
> -- 
> Konrad Mauz
> Rechenzentrum
> Hochschule Technik, Wirtschaft und Gestaltung
> Braunegger-Strasse 55, D 78462 Konstanz
> e-mail: kmauz-5HlQSm0/[email protected]
> Tel.:   +49 7531 206-472
> Fax.:   +49 7531 206-153
>
> ---------------------------------------------------------------------- 
> ---
> 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
> _______________________________________________
> Spyce-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/spyce-users


-------------------------------------------------------------------------
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