default-value for display tag in form fields

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

default-value for display tag in form fields

Bruno Busco
Hi,
I need to show a default string (e.g. "None") in a field of a form of type
"list".
I was looking for something like...

<field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
    <display default-value="${uiLabelMap.CommonNone}"/>
</field>

...but the display tag does not support the default-value.

Would it make sense to add it?

Thanks,
Bruno
Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

Jacques Le Roux
Administrator
Hi Bruno,

In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?

Jacques

From: "Bruno Busco" <[hidden email]>

> Hi,
> I need to show a default string (e.g. "None") in a field of a form of type
> "list".
> I was looking for something like...
>
> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>    <display default-value="${uiLabelMap.CommonNone}"/>
> </field>
>
> ...but the display tag does not support the default-value.
>
> Would it make sense to add it?
>
> Thanks,
> Bruno
>

Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

Malin Nicolas
Le 31/08/2010 19:29, Jacques Le Roux a écrit :
> Hi Bruno,
>
> In such case I handle the field with set and groovy before in the
> row-action. But yes, why not a default-value?
>
> Jacques
+1 for default-value. It's many case that possible to show a value if
nothing is present in context.

Nicolas

>
> From: "Bruno Busco" <[hidden email]>
>> Hi,
>> I need to show a default string (e.g. "None") in a field of a form of
>> type
>> "list".
>> I was looking for something like...
>>
>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}"
>> sort-field="true">
>> <display default-value="${uiLabelMap.CommonNone}"/>
>> </field>
>>
>> ...but the display tag does not support the default-value.
>>
>> Would it make sense to add it?
>>
>> Thanks,
>> Bruno
>>
>


--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/

Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

Scott Gray-2
In reply to this post by Jacques Le Roux
Sounds fine to me.  As an alternative you can do something like this:
<display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
I know it's a bit verbose but it should also work.  "empty" is a UEL operator that works in a similar fashion to Groovy's "Truth" boolean casting.  

Unfortunately UEL doesn't support groovy's elvis operator or it would be easier:
"${usage ?: uiLabelMap.CommonNone}"
or perhaps freemarker's default value operator:
"${usage!uiLabelMap.CommonNone}"

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:

> Hi Bruno,
>
> In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?
>
> Jacques
>
> From: "Bruno Busco" <[hidden email]>
>> Hi,
>> I need to show a default string (e.g. "None") in a field of a form of type
>> "list".
>> I was looking for something like...
>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>>   <display default-value="${uiLabelMap.CommonNone}"/>
>> </field>
>> ...but the display tag does not support the default-value.
>> Would it make sense to add it?
>> Thanks,
>> Bruno
>>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

David E. Jones-2

I agree, Groovy is not just way better than BSH, but also better than UEL too. It might be a bit of a pain to change now, but I don't know. While designing based on the idea of starting over I was planning on a move to "everything's Groovy" to use Groovy for all expressions, scriptlets, and inline scripts and scripts in separate files.

Of course, that brings up the question... why not just use Grails where every artifact is a groovy script instead of having some artifacts as XML? Well, IMO for many things XML is easier and cleaner for both writing and reading/maintaining. If you don't like that, well, Grails isn't too bad as frameworks go... :)

-David


On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:

> Sounds fine to me.  As an alternative you can do something like this:
> <display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
> I know it's a bit verbose but it should also work.  "empty" is a UEL operator that works in a similar fashion to Groovy's "Truth" boolean casting.  
>
> Unfortunately UEL doesn't support groovy's elvis operator or it would be easier:
> "${usage ?: uiLabelMap.CommonNone}"
> or perhaps freemarker's default value operator:
> "${usage!uiLabelMap.CommonNone}"
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>
>> Hi Bruno,
>>
>> In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?
>>
>> Jacques
>>
>> From: "Bruno Busco" <[hidden email]>
>>> Hi,
>>> I need to show a default string (e.g. "None") in a field of a form of type
>>> "list".
>>> I was looking for something like...
>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>>>  <display default-value="${uiLabelMap.CommonNone}"/>
>>> </field>
>>> ...but the display tag does not support the default-value.
>>> Would it make sense to add it?
>>> Thanks,
>>> Bruno
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

Jacques Le Roux
Administrator
From: "David E Jones" <[hidden email]>
> I agree, Groovy is not just way better than BSH, but also better than UEL too. It might be a bit of a pain to change now, but I
> don't know. While designing based on the idea of starting over I was planning on a move to "everything's Groovy" to use Groovy for
> all expressions, scriptlets, and inline scripts and scripts in separate files.

Yes, I'd like it, more powerful, consistent and better syntax

Jacques

> Of course, that brings up the question... why not just use Grails where every artifact is a groovy script instead of having some
> artifacts as XML? Well, IMO for many things XML is easier and cleaner for both writing and reading/maintaining. If you don't like
> that, well, Grails isn't too bad as frameworks go... :)
>
> -David
>
>
> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
>
>> Sounds fine to me.  As an alternative you can do something like this:
>> <display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
>> I know it's a bit verbose but it should also work.  "empty" is a UEL operator that works in a similar fashion to Groovy's "Truth"
>> boolean casting.
>>
>> Unfortunately UEL doesn't support groovy's elvis operator or it would be easier:
>> "${usage ?: uiLabelMap.CommonNone}"
>> or perhaps freemarker's default value operator:
>> "${usage!uiLabelMap.CommonNone}"
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>>
>>> Hi Bruno,
>>>
>>> In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?
>>>
>>> Jacques
>>>
>>> From: "Bruno Busco" <[hidden email]>
>>>> Hi,
>>>> I need to show a default string (e.g. "None") in a field of a form of type
>>>> "list".
>>>> I was looking for something like...
>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>>>>  <display default-value="${uiLabelMap.CommonNone}"/>
>>>> </field>
>>>> ...but the display tag does not support the default-value.
>>>> Would it make sense to add it?
>>>> Thanks,
>>>> Bruno
>>>>
>>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

Scott Gray-2
I wasn't actually suggesting it my email, I was just lamenting the missing ?: operator.  But I admit I've wondered from time to time why we didn't just use groovy as our expression tool, with support for categories, operator overloading and closures, I can't really think of anything that UEL can do that groovy can't.

Regards
Scott

On 1/09/2010, at 9:07 PM, Jacques Le Roux wrote:

> From: "David E Jones" <[hidden email]>
>> I agree, Groovy is not just way better than BSH, but also better than UEL too. It might be a bit of a pain to change now, but I
>> don't know. While designing based on the idea of starting over I was planning on a move to "everything's Groovy" to use Groovy for
>> all expressions, scriptlets, and inline scripts and scripts in separate files.
>
> Yes, I'd like it, more powerful, consistent and better syntax
>
> Jacques
>
>> Of course, that brings up the question... why not just use Grails where every artifact is a groovy script instead of having some
>> artifacts as XML? Well, IMO for many things XML is easier and cleaner for both writing and reading/maintaining. If you don't like
>> that, well, Grails isn't too bad as frameworks go... :)
>>
>> -David
>>
>>
>> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
>>
>>> Sounds fine to me.  As an alternative you can do something like this:
>>> <display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
>>> I know it's a bit verbose but it should also work.  "empty" is a UEL operator that works in a similar fashion to Groovy's "Truth"
>>> boolean casting.
>>>
>>> Unfortunately UEL doesn't support groovy's elvis operator or it would be easier:
>>> "${usage ?: uiLabelMap.CommonNone}"
>>> or perhaps freemarker's default value operator:
>>> "${usage!uiLabelMap.CommonNone}"
>>>
>>> Regards
>>> Scott
>>>
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>>
>>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>>>
>>>> Hi Bruno,
>>>>
>>>> In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?
>>>>
>>>> Jacques
>>>>
>>>> From: "Bruno Busco" <[hidden email]>
>>>>> Hi,
>>>>> I need to show a default string (e.g. "None") in a field of a form of type
>>>>> "list".
>>>>> I was looking for something like...
>>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>>>>> <display default-value="${uiLabelMap.CommonNone}"/>
>>>>> </field>
>>>>> ...but the display tag does not support the default-value.
>>>>> Would it make sense to add it?
>>>>> Thanks,
>>>>> Bruno
>>>>>
>>>>
>>>
>>
>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

Bruno Busco
Thank you,
-Bruno

2010/9/1 Scott Gray <[hidden email]>

> I wasn't actually suggesting it my email, I was just lamenting the missing
> ?: operator.  But I admit I've wondered from time to time why we didn't just
> use groovy as our expression tool, with support for categories, operator
> overloading and closures, I can't really think of anything that UEL can do
> that groovy can't.
>
> Regards
> Scott
>
> On 1/09/2010, at 9:07 PM, Jacques Le Roux wrote:
>
> > From: "David E Jones" <[hidden email]>
> >> I agree, Groovy is not just way better than BSH, but also better than
> UEL too. It might be a bit of a pain to change now, but I
> >> don't know. While designing based on the idea of starting over I was
> planning on a move to "everything's Groovy" to use Groovy for
> >> all expressions, scriptlets, and inline scripts and scripts in separate
> files.
> >
> > Yes, I'd like it, more powerful, consistent and better syntax
> >
> > Jacques
> >
> >> Of course, that brings up the question... why not just use Grails where
> every artifact is a groovy script instead of having some
> >> artifacts as XML? Well, IMO for many things XML is easier and cleaner
> for both writing and reading/maintaining. If you don't like
> >> that, well, Grails isn't too bad as frameworks go... :)
> >>
> >> -David
> >>
> >>
> >> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
> >>
> >>> Sounds fine to me.  As an alternative you can do something like this:
> >>> <display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
> >>> I know it's a bit verbose but it should also work.  "empty" is a UEL
> operator that works in a similar fashion to Groovy's "Truth"
> >>> boolean casting.
> >>>
> >>> Unfortunately UEL doesn't support groovy's elvis operator or it would
> be easier:
> >>> "${usage ?: uiLabelMap.CommonNone}"
> >>> or perhaps freemarker's default value operator:
> >>> "${usage!uiLabelMap.CommonNone}"
> >>>
> >>> Regards
> >>> Scott
> >>>
> >>> HotWax Media
> >>> http://www.hotwaxmedia.com
> >>>
> >>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
> >>>
> >>>> Hi Bruno,
> >>>>
> >>>> In such case I handle the field with set and groovy before in the
> row-action. But yes, why not a default-value?
> >>>>
> >>>> Jacques
> >>>>
> >>>> From: "Bruno Busco" <[hidden email]>
> >>>>> Hi,
> >>>>> I need to show a default string (e.g. "None") in a field of a form of
> type
> >>>>> "list".
> >>>>> I was looking for something like...
> >>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}"
> sort-field="true">
> >>>>> <display default-value="${uiLabelMap.CommonNone}"/>
> >>>>> </field>
> >>>>> ...but the display tag does not support the default-value.
> >>>>> Would it make sense to add it?
> >>>>> Thanks,
> >>>>> Bruno
> >>>>>
> >>>>
> >>>
> >>
> >
> >
>
>
Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

Bruno Busco
Thank you guys.
Done in trunk at  rev. 992441

-Bruno

2010/9/1 Bruno Busco <[hidden email]>

> Thank you,
> -Bruno
>
> 2010/9/1 Scott Gray <[hidden email]>
>
> I wasn't actually suggesting it my email, I was just lamenting the missing
>> ?: operator.  But I admit I've wondered from time to time why we didn't just
>> use groovy as our expression tool, with support for categories, operator
>> overloading and closures, I can't really think of anything that UEL can do
>> that groovy can't.
>>
>> Regards
>> Scott
>>
>> On 1/09/2010, at 9:07 PM, Jacques Le Roux wrote:
>>
>> > From: "David E Jones" <[hidden email]>
>> >> I agree, Groovy is not just way better than BSH, but also better than
>> UEL too. It might be a bit of a pain to change now, but I
>> >> don't know. While designing based on the idea of starting over I was
>> planning on a move to "everything's Groovy" to use Groovy for
>> >> all expressions, scriptlets, and inline scripts and scripts in separate
>> files.
>> >
>> > Yes, I'd like it, more powerful, consistent and better syntax
>> >
>> > Jacques
>> >
>> >> Of course, that brings up the question... why not just use Grails where
>> every artifact is a groovy script instead of having some
>> >> artifacts as XML? Well, IMO for many things XML is easier and cleaner
>> for both writing and reading/maintaining. If you don't like
>> >> that, well, Grails isn't too bad as frameworks go... :)
>> >>
>> >> -David
>> >>
>> >>
>> >> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
>> >>
>> >>> Sounds fine to me.  As an alternative you can do something like this:
>> >>> <display description="${empty usage ? uiLabelMap.CommonNone :
>> usage}"/>
>> >>> I know it's a bit verbose but it should also work.  "empty" is a UEL
>> operator that works in a similar fashion to Groovy's "Truth"
>> >>> boolean casting.
>> >>>
>> >>> Unfortunately UEL doesn't support groovy's elvis operator or it would
>> be easier:
>> >>> "${usage ?: uiLabelMap.CommonNone}"
>> >>> or perhaps freemarker's default value operator:
>> >>> "${usage!uiLabelMap.CommonNone}"
>> >>>
>> >>> Regards
>> >>> Scott
>> >>>
>> >>> HotWax Media
>> >>> http://www.hotwaxmedia.com
>> >>>
>> >>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>> >>>
>> >>>> Hi Bruno,
>> >>>>
>> >>>> In such case I handle the field with set and groovy before in the
>> row-action. But yes, why not a default-value?
>> >>>>
>> >>>> Jacques
>> >>>>
>> >>>> From: "Bruno Busco" <[hidden email]>
>> >>>>> Hi,
>> >>>>> I need to show a default string (e.g. "None") in a field of a form
>> of type
>> >>>>> "list".
>> >>>>> I was looking for something like...
>> >>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}"
>> sort-field="true">
>> >>>>> <display default-value="${uiLabelMap.CommonNone}"/>
>> >>>>> </field>
>> >>>>> ...but the display tag does not support the default-value.
>> >>>>> Would it make sense to add it?
>> >>>>> Thanks,
>> >>>>> Bruno
>> >>>>>
>> >>>>
>> >>>
>> >>
>> >
>> >
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: default-value for display tag in form fields

Jacques Le Roux
Administrator
As a reminder, I have created
"Replace all other uses than Groovy (UEL and BSH) by Groovy in widgets and minilang"
at https://issues.apache.org/jira/browse/OFBIZ-3948

Jacques

From: "Bruno Busco" <[hidden email]>

> Thank you guys.
> Done in trunk at  rev. 992441
>
> -Bruno
>
> 2010/9/1 Bruno Busco <[hidden email]>
>
>> Thank you,
>> -Bruno
>>
>> 2010/9/1 Scott Gray <[hidden email]>
>>
>> I wasn't actually suggesting it my email, I was just lamenting the missing
>>> ?: operator.  But I admit I've wondered from time to time why we didn't just
>>> use groovy as our expression tool, with support for categories, operator
>>> overloading and closures, I can't really think of anything that UEL can do
>>> that groovy can't.
>>>
>>> Regards
>>> Scott
>>>
>>> On 1/09/2010, at 9:07 PM, Jacques Le Roux wrote:
>>>
>>> > From: "David E Jones" <[hidden email]>
>>> >> I agree, Groovy is not just way better than BSH, but also better than
>>> UEL too. It might be a bit of a pain to change now, but I
>>> >> don't know. While designing based on the idea of starting over I was
>>> planning on a move to "everything's Groovy" to use Groovy for
>>> >> all expressions, scriptlets, and inline scripts and scripts in separate
>>> files.
>>> >
>>> > Yes, I'd like it, more powerful, consistent and better syntax
>>> >
>>> > Jacques
>>> >
>>> >> Of course, that brings up the question... why not just use Grails where
>>> every artifact is a groovy script instead of having some
>>> >> artifacts as XML? Well, IMO for many things XML is easier and cleaner
>>> for both writing and reading/maintaining. If you don't like
>>> >> that, well, Grails isn't too bad as frameworks go... :)
>>> >>
>>> >> -David
>>> >>
>>> >>
>>> >> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
>>> >>
>>> >>> Sounds fine to me.  As an alternative you can do something like this:
>>> >>> <display description="${empty usage ? uiLabelMap.CommonNone :
>>> usage}"/>
>>> >>> I know it's a bit verbose but it should also work.  "empty" is a UEL
>>> operator that works in a similar fashion to Groovy's "Truth"
>>> >>> boolean casting.
>>> >>>
>>> >>> Unfortunately UEL doesn't support groovy's elvis operator or it would
>>> be easier:
>>> >>> "${usage ?: uiLabelMap.CommonNone}"
>>> >>> or perhaps freemarker's default value operator:
>>> >>> "${usage!uiLabelMap.CommonNone}"
>>> >>>
>>> >>> Regards
>>> >>> Scott
>>> >>>
>>> >>> HotWax Media
>>> >>> http://www.hotwaxmedia.com
>>> >>>
>>> >>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>>> >>>
>>> >>>> Hi Bruno,
>>> >>>>
>>> >>>> In such case I handle the field with set and groovy before in the
>>> row-action. But yes, why not a default-value?
>>> >>>>
>>> >>>> Jacques
>>> >>>>
>>> >>>> From: "Bruno Busco" <[hidden email]>
>>> >>>>> Hi,
>>> >>>>> I need to show a default string (e.g. "None") in a field of a form
>>> of type
>>> >>>>> "list".
>>> >>>>> I was looking for something like...
>>> >>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}"
>>> sort-field="true">
>>> >>>>> <display default-value="${uiLabelMap.CommonNone}"/>
>>> >>>>> </field>
>>> >>>>> ...but the display tag does not support the default-value.
>>> >>>>> Would it make sense to add it?
>>> >>>>> Thanks,
>>> >>>>> Bruno
>>> >>>>>
>>> >>>>
>>> >>>
>>> >>
>>> >
>>> >
>>>
>>>
>>
>