[PHPTAL] How managing checked="checked" ?
Krzysztof Sikorski
dreamer.pl at gmail.com
Sat Apr 26 22:04:26 CEST 2008
> If ($agreement) {
>
> <input type="checkbox" name="agreement" value="1" checked="checked" />
>
> } else {
>
> <input type="checkbox" name="agreement" value="1" />
>
> }
Exact conversion of your code would be:
<input tal:condition="agreement" type="checkbox" name="agreement"
value="1" checked="checked" />
<inout tal:condition="not:agreement" type="checkbox" name="agreement"
value="1" />
You could also try code like this, but if condition evaluates to false
it will produce an empty argument instead of removing it completely -
which is not exactly what you asked for:
<input type="checkbox" name="agreement" value="1"
tal:attributes="checked php: agreement ? checked : null" />
More information about the PHPTAL
mailing list