|
From: Buddy T. <me...@my...> - 2006-07-26 04:07:40
|
Actually, I tried using a span with flexy:if and the Smarty-like way
but flexy complaint about having two instances of the checkbox. I guess
its because it evaluates the input nodes with out processing the "if"
statements. Whatever, long as there is a solution at works.
Thank you so much for your help, I really am loving WASP. The framework
is so smart and simple to use and has a lightweight code base.
On Jul 25, 2006, at 9:54 PM, Joshua Doss wrote:
> There's a number of approaches you could take, like not using
> flexy:ignore and wrapping each checkbox in a div or span with the
> flexy:if within that tag. Or use the Smarty-esque
> {if:variable}{else:}{end:} syntax.
>
> Personally I like using the bracket-based syntax as little as possible.
>
> -J.
>
>
> Buddy Toups wrote:
>> Thanks Joshua
>> I tried your suggestion and the following error occurred:
>> Error:/Users/buddytoups/Sites/teamtrident_app//./UserAdd/templates/
>> index.chunk on Line 16 <INPUT>: You can not mix flexy:if= or
>> flexy:foreach= with dynamic form elements (turn off tag to element
>> code with flexyIgnore=0, use flexy:ignore="yes" in the tag or put the
>> conditional outside in a span tag
>> So I tried adding flexy:ignore="yes" and it works:
>> <input type="checkbox" name="admin_jobs" checked="checked"
>> flexy:if="isChecked" flexy:ignore="yes" />
>> <input type="checkbox" name="admin_jobs" flexy:if="isNotChecked"
>> flexy:ignore="yes" />
>> It's a little weird, but it works and is not to complicated.
>> Thanks for the help,
>> Buddy Toups
>> On Jul 25, 2006, at 1:39 PM, Joshua Doss wrote:
>>> 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
>>>
>
|