I guess something like this should work.

<input type="radio" tal:attributes="checked php:P.civility eq 'Miss'"
value="Miss" ... />
<input type="radio" tal:attributes="checked php:P.civility eq 'Ms'"
value="Ms" ... />
<input type="radio" tal:attributes="checked php:P.civility eq 'Mr'"
value="Mr" ... />

This is one of those examples, and forms in general,  where a Tal doesn't
shine much.

regards,
/imv

On Fri, Aug 7, 2009 at 4:08 PM, Guillaume Lecanu <guilla...@lya.fr> wrote:

>  Hi again,
>
> I have in my form a field "civility" like that :
>
>             <label>Civility</label>
>             <ul>
>             <li>
>                 <input type="radio" name="civility" value="Miss"
> id="civility-miss" />
>                 <label for="civility-miss">Miss</label>
>             </li>
>             <li>
>                 <input type="radio" name="civility" value="Ms"
> id="civility-ms" />
>                 <label for="civility-ms">Ms</label>
>             </li>
>             <li>
>                 <input type="radio" name="civility" value="Mr"
> id="civility-mr"  />
>                 <label for="civility-mr">Mr</label>
>             </li>
>             </ul>
>
> If the form is submitted with errors, I need to pre-fill the "civility"
> field with the previous selected value.
> I give the $_POST array to PHPTAL like that : $tpl->set('P', $_POST), so I
> can access to this value by "P/civility"
>
> What is the best way to have no radio-buttons selected if P/civility
> doesn't exist, and to have the good radio-button selected dependant of the
> value found into P/civility ?
>
> Thanks in advance for your help !
>
> _______________________________________________
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to