|
From: Joshua D. <jos...@op...> - 2006-07-28 05:22:39
|
A cheap way to do this would be to have two checkboxes. Your controller
would look like:
if ($myDatabaseBoolean)
{
$this->setPlaceholder('isChecked', 'true');
}
else
{
$this->setPlaceholder('isNotChecked', 'true');
}
Then your flexy code would be:
<input type="checkbox" name='mycheckbox" checked="checked"
flexy:if="isChecked" />
<input type="checkbox" name='mycheckbox" flexy:if="isNotChecked" />
This is because flexy:if translates to--essentially--an isset/defined
sort of boolean.
The direct Flexy API itself provides a means to set arbitrary key/value
pairs within a tag for a given id, but the Chunk API does not re-expose
this functionality to the end-user. The Flexy API strikes me as a bit
painful for this sort of use.
-J.
Buddy Toups wrote:
> Hi, I really new to WASP (really dig it!) and had experience with
> Smarty. Flexy is much cooler, but I have a small problem. I want to
> make a checkbox select depending on a variable from a database.
>
> This is what I want outputted if the preset value is true:
> <input name="mycheckbox" type="checkbox" checked="checked" />
>
> or if its false:
> <input name="mycheckbox" type="checkbox" />
>
> I've tried using a string and a placeholder but Flexy comes up with an
> error.
>
> Controller code:
> if($myDatabaseBoolean){
> $this->setPlaceholder('checkedString', ' checked="checked" ');
> }
>
> Chuck code:
> <input name="mycheckbox" type="checkbox" {checkedString} />
>
> If someone can please help me with this issue that would be great.
>
> Thanks,
> Buddy
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wasp-users mailing list
> Was...@li...
> https://lists.sourceforge.net/lists/listinfo/wasp-users
|