RE: [SMARTY-DEV] Checkbox syntax

From: Date: Mon, 05 May 2003 19:34:22 +0000
Subject: RE: [SMARTY-DEV] Checkbox syntax
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1359@lists.php.net to get a copy of this message
If you're not using the {checkboxes} function, maybe use an array {if in_array($mychecks[foo], $selected_vals)} On Mon, 2003-05-05 at 14:31, luis wrote: > What do you put in the if? > {if $smarty.request.mychecks[??]}checked="checked"{/if} > > -----Original Message----- > From: Monte Ohrt [mailto:monte@ispi.net] > Sent: Monday, May 05, 2003 4:19 PM > To: luis > Cc: 'Smarty Dev' > Subject: Re: [SMARTY-DEV] Checkbox syntax > > Use an array instead of separately named checkboxes: > > <input type="checkbox" name="mychecks[]" > value="{$mychecks[foo]}" {if > ..}checked="checked"{/if}> > > On Mon, 2003-05-05 at 14:15, luis wrote: > > Let's suposse I have checkboxes inside a section loop so the "name" of > > each checkbox is: > > <input type="checkbox" name="{elements[$foo[ix]]}" /> > > > > I want to preserve checked boxes when processing a form in the script > .. > > Tried something like.. > > > > <input type="checkbox" name="{elements[$foo[ix]]}" {if > > $smarty.request.elements[$foo[ix]]}checked="checked"{/if} /> > > > > but it doesn't work. > > Which is the best way to do this? Maybe I'm overlooking something more > > elegant.. > > > > Luis > > -- Monte Ohrt <monte@ispi.net>

« previous php.smarty.dev (#1359) next »