You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Jeremy Olmstead <jo...@gmail.com> on 2010/07/12 20:04:09 UTC

Modifying Form Data

I would like to be able to take data to be displayed in a forms text field
and manipulate it before it is displayed.  How can I do this?  See below
for relevant example code.  Here I want to display estimatedSetupMillis as
minutes instead of milliseconds.

file: RoutingTaskForms.xml
<form name="EditRoutingTask" target="UpdateRoutingTask"
extends="EditRoutingTask"
extends-resource="component://manufacturing/widget/manufacturing/RoutingTaskForms.xml">
        <actions>
            <set field="estimatedSetupMillis" value="${groovy:
return(estimatedSetupMillis/60000);}"/>
        </actions>

This doesn't do anything.  If I change the actions section to below, I get a
"1" when creating a new task, but when editing a task I still just get the
milliseconds.  Obviously when in edit mode it just replaces
estimatedSetupMillis with whatever is in the database.  I also have a
feeling that estimatedSetupMillis may not be defined yet in the actions
section.  How can I make it so I can modify the data before it gets
displayed?

        <actions>
            <set field="estimatedSetupMillis" value="1"/>
        </actions>

Regards,
Jeremy Olmstead

Re: Modifying Form Data

Posted by Scott Gray <sc...@hotwaxmedia.com>.
The principal is the same.  Use a form action to set a new field:
<set field="estimatedMinutes" value="${groovy:estimatedSetupMillis/60000}"/>
and then use that field as for your form field:
<field name="estimatedSetupMillis" field-name="estimatedMinutes"><text/></field>

The above assumes that you want the parameter on form submit to be called estimatedSetupMillis, if you don't need that then just change the name attribute to estimatedMinutes and remove the field-name attribute.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 14/07/2010, at 8:25 AM, Jeremy Olmstead wrote:

> But I want it to be editable.  Isn't display just informational?
> 
> On Mon, Jul 12, 2010 at 11:33 PM, Atul Vani <at...@hotwaxmedia.com>wrote:
> 
>> Hi Jeremy,
>> 
>> how about using it like
>> <field><display description="${groovy:
>> return(estimatedSetupMillis/60000);}"/></field>
>> or something similar.
>> 
>> --
>> Thanks & Regards
>> Atul Vani
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>> http://www.hotwaxmedia.com/
>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
>> yourself.
>> 
>> 
>> Jeremy Olmstead wrote:
>> 
>>> Thanks for the response.  When I change from actions to row-actions I get
>>> nothing.  Not even the "1" when entering a new routing.  Am I missing
>>> something?  And yes, I realize this will not update to the database.  I
>>> plan
>>> to intercept UpdateRoutingTask and convert the data back to milliseconds
>>> before updating.
>>> 
>>> Jeremy
>>> 
>>> On Mon, Jul 12, 2010 at 1:35 PM, Adrian Crum <ad...@hlmksw.com> wrote:
>>> 
>>> 
>>> 
>>>> You will need a row action for that. Keep in mind if you change the
>>>> field's
>>>> value on the fly like that and the user clicks Save, the wrong value will
>>>> get saved.
>>>> 
>>>> -Adrian
>>>> 
>>>> 
>>>> On 7/12/2010 11:04 AM, Jeremy Olmstead wrote:
>>>> 
>>>> 
>>>> 
>>>>> I would like to be able to take data to be displayed in a forms text
>>>>> field
>>>>> and manipulate it before it is displayed.  How can I do this?  See below
>>>>> for relevant example code.  Here I want to display estimatedSetupMillis
>>>>> as
>>>>> minutes instead of milliseconds.
>>>>> 
>>>>> file: RoutingTaskForms.xml
>>>>> <form name="EditRoutingTask" target="UpdateRoutingTask"
>>>>> extends="EditRoutingTask"
>>>>> 
>>>>> 
>>>>> extends-resource="component://manufacturing/widget/manufacturing/RoutingTaskForms.xml">
>>>>>       <actions>
>>>>>           <set field="estimatedSetupMillis" value="${groovy:
>>>>> return(estimatedSetupMillis/60000);}"/>
>>>>>       </actions>
>>>>> 
>>>>> This doesn't do anything.  If I change the actions section to below, I
>>>>> get
>>>>> a
>>>>> "1" when creating a new task, but when editing a task I still just get
>>>>> the
>>>>> milliseconds.  Obviously when in edit mode it just replaces
>>>>> estimatedSetupMillis with whatever is in the database.  I also have a
>>>>> feeling that estimatedSetupMillis may not be defined yet in the actions
>>>>> section.  How can I make it so I can modify the data before it gets
>>>>> displayed?
>>>>> 
>>>>>       <actions>
>>>>>           <set field="estimatedSetupMillis" value="1"/>
>>>>>       </actions>
>>>>> 
>>>>> Regards,
>>>>> Jeremy Olmstead
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 


Re: Modifying Form Data

Posted by Jeremy Olmstead <jo...@gmail.com>.
Thanks for trying to help...I am learning something, but my problem is still
not resolved.  It seems that estimatedSetupMillis is not defined at this
point.  Whether I put it under <row-actions>, <actions>, or in the
default-value attribute of text I get nothing in all three cases.  If I
replace estimatedSetupMillis with a hard coded number it works.  At what
point is estimatedSetupMillis defined or do I need to use a specific map?  I
tried parameters and context, but neither helped.

Thanks,
Jeremy

On Wed, Jul 14, 2010 at 12:19 AM, Atul Vani <at...@hotwaxmedia.com>wrote:

> Hi Jeremy,
>
> well, I said something similar,
> so if it's a <text/> you can use <text default-value="..."/>
>
>
> --
> Thanks & Regards
> Atul Vani
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
> http://www.hotwaxmedia.com/
> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
> yourself.
>
> Jeremy Olmstead wrote:
>
>> But I want it to be editable.  Isn't display just informational?
>>
>> On Mon, Jul 12, 2010 at 11:33 PM, Atul Vani <atul.vani@hotwaxmedia.com
>> >wrote:
>>
>>
>>
>>> Hi Jeremy,
>>>
>>> how about using it like
>>> <field><display description="${groovy:
>>> return(estimatedSetupMillis/60000);}"/></field>
>>> or something similar.
>>>
>>> --
>>> Thanks & Regards
>>> Atul Vani
>>> Enterprise Software Developer
>>> HotWax Media Pvt. Ltd.
>>> http://www.hotwaxmedia.com/
>>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
>>> yourself.
>>>
>>>
>>> Jeremy Olmstead wrote:
>>>
>>>
>>>
>>>> Thanks for the response.  When I change from actions to row-actions I
>>>> get
>>>> nothing.  Not even the "1" when entering a new routing.  Am I missing
>>>> something?  And yes, I realize this will not update to the database.  I
>>>> plan
>>>> to intercept UpdateRoutingTask and convert the data back to milliseconds
>>>> before updating.
>>>>
>>>> Jeremy
>>>>
>>>> On Mon, Jul 12, 2010 at 1:35 PM, Adrian Crum <ad...@hlmksw.com>
>>>> wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> You will need a row action for that. Keep in mind if you change the
>>>>> field's
>>>>> value on the fly like that and the user clicks Save, the wrong value
>>>>> will
>>>>> get saved.
>>>>>
>>>>> -Adrian
>>>>>
>>>>>
>>>>> On 7/12/2010 11:04 AM, Jeremy Olmstead wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> I would like to be able to take data to be displayed in a forms text
>>>>>> field
>>>>>> and manipulate it before it is displayed.  How can I do this?  See
>>>>>> below
>>>>>> for relevant example code.  Here I want to display
>>>>>> estimatedSetupMillis
>>>>>> as
>>>>>> minutes instead of milliseconds.
>>>>>>
>>>>>> file: RoutingTaskForms.xml
>>>>>> <form name="EditRoutingTask" target="UpdateRoutingTask"
>>>>>> extends="EditRoutingTask"
>>>>>>
>>>>>>
>>>>>>
>>>>>> extends-resource="component://manufacturing/widget/manufacturing/RoutingTaskForms.xml">
>>>>>>       <actions>
>>>>>>           <set field="estimatedSetupMillis" value="${groovy:
>>>>>> return(estimatedSetupMillis/60000);}"/>
>>>>>>       </actions>
>>>>>>
>>>>>> This doesn't do anything.  If I change the actions section to below, I
>>>>>> get
>>>>>> a
>>>>>> "1" when creating a new task, but when editing a task I still just get
>>>>>> the
>>>>>> milliseconds.  Obviously when in edit mode it just replaces
>>>>>> estimatedSetupMillis with whatever is in the database.  I also have a
>>>>>> feeling that estimatedSetupMillis may not be defined yet in the
>>>>>> actions
>>>>>> section.  How can I make it so I can modify the data before it gets
>>>>>> displayed?
>>>>>>
>>>>>>       <actions>
>>>>>>           <set field="estimatedSetupMillis" value="1"/>
>>>>>>       </actions>
>>>>>>
>>>>>> Regards,
>>>>>> Jeremy Olmstead
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>

Re: Modifying Form Data

Posted by Atul Vani <at...@hotwaxmedia.com>.
Hi Jeremy,

well, I said something similar,
so if it's a <text/> you can use <text default-value="..."/>

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.

Jeremy Olmstead wrote:
> But I want it to be editable.  Isn't display just informational?
>
> On Mon, Jul 12, 2010 at 11:33 PM, Atul Vani <at...@hotwaxmedia.com>wrote:
>
>   
>> Hi Jeremy,
>>
>> how about using it like
>> <field><display description="${groovy:
>> return(estimatedSetupMillis/60000);}"/></field>
>> or something similar.
>>
>> --
>> Thanks & Regards
>> Atul Vani
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>> http://www.hotwaxmedia.com/
>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
>> yourself.
>>
>>
>> Jeremy Olmstead wrote:
>>
>>     
>>> Thanks for the response.  When I change from actions to row-actions I get
>>> nothing.  Not even the "1" when entering a new routing.  Am I missing
>>> something?  And yes, I realize this will not update to the database.  I
>>> plan
>>> to intercept UpdateRoutingTask and convert the data back to milliseconds
>>> before updating.
>>>
>>> Jeremy
>>>
>>> On Mon, Jul 12, 2010 at 1:35 PM, Adrian Crum <ad...@hlmksw.com> wrote:
>>>
>>>
>>>
>>>       
>>>> You will need a row action for that. Keep in mind if you change the
>>>> field's
>>>> value on the fly like that and the user clicks Save, the wrong value will
>>>> get saved.
>>>>
>>>> -Adrian
>>>>
>>>>
>>>> On 7/12/2010 11:04 AM, Jeremy Olmstead wrote:
>>>>
>>>>
>>>>
>>>>         
>>>>> I would like to be able to take data to be displayed in a forms text
>>>>> field
>>>>> and manipulate it before it is displayed.  How can I do this?  See below
>>>>> for relevant example code.  Here I want to display estimatedSetupMillis
>>>>> as
>>>>> minutes instead of milliseconds.
>>>>>
>>>>> file: RoutingTaskForms.xml
>>>>> <form name="EditRoutingTask" target="UpdateRoutingTask"
>>>>> extends="EditRoutingTask"
>>>>>
>>>>>
>>>>> extends-resource="component://manufacturing/widget/manufacturing/RoutingTaskForms.xml">
>>>>>        <actions>
>>>>>            <set field="estimatedSetupMillis" value="${groovy:
>>>>> return(estimatedSetupMillis/60000);}"/>
>>>>>        </actions>
>>>>>
>>>>> This doesn't do anything.  If I change the actions section to below, I
>>>>> get
>>>>> a
>>>>> "1" when creating a new task, but when editing a task I still just get
>>>>> the
>>>>> milliseconds.  Obviously when in edit mode it just replaces
>>>>> estimatedSetupMillis with whatever is in the database.  I also have a
>>>>> feeling that estimatedSetupMillis may not be defined yet in the actions
>>>>> section.  How can I make it so I can modify the data before it gets
>>>>> displayed?
>>>>>
>>>>>        <actions>
>>>>>            <set field="estimatedSetupMillis" value="1"/>
>>>>>        </actions>
>>>>>
>>>>> Regards,
>>>>> Jeremy Olmstead
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>       
>
>   

Re: Modifying Form Data

Posted by Jeremy Olmstead <jo...@gmail.com>.
But I want it to be editable.  Isn't display just informational?

On Mon, Jul 12, 2010 at 11:33 PM, Atul Vani <at...@hotwaxmedia.com>wrote:

> Hi Jeremy,
>
> how about using it like
> <field><display description="${groovy:
> return(estimatedSetupMillis/60000);}"/></field>
> or something similar.
>
> --
> Thanks & Regards
> Atul Vani
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
> http://www.hotwaxmedia.com/
> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
> yourself.
>
>
> Jeremy Olmstead wrote:
>
>> Thanks for the response.  When I change from actions to row-actions I get
>> nothing.  Not even the "1" when entering a new routing.  Am I missing
>> something?  And yes, I realize this will not update to the database.  I
>> plan
>> to intercept UpdateRoutingTask and convert the data back to milliseconds
>> before updating.
>>
>> Jeremy
>>
>> On Mon, Jul 12, 2010 at 1:35 PM, Adrian Crum <ad...@hlmksw.com> wrote:
>>
>>
>>
>>> You will need a row action for that. Keep in mind if you change the
>>> field's
>>> value on the fly like that and the user clicks Save, the wrong value will
>>> get saved.
>>>
>>> -Adrian
>>>
>>>
>>> On 7/12/2010 11:04 AM, Jeremy Olmstead wrote:
>>>
>>>
>>>
>>>> I would like to be able to take data to be displayed in a forms text
>>>> field
>>>> and manipulate it before it is displayed.  How can I do this?  See below
>>>> for relevant example code.  Here I want to display estimatedSetupMillis
>>>> as
>>>> minutes instead of milliseconds.
>>>>
>>>> file: RoutingTaskForms.xml
>>>> <form name="EditRoutingTask" target="UpdateRoutingTask"
>>>> extends="EditRoutingTask"
>>>>
>>>>
>>>> extends-resource="component://manufacturing/widget/manufacturing/RoutingTaskForms.xml">
>>>>        <actions>
>>>>            <set field="estimatedSetupMillis" value="${groovy:
>>>> return(estimatedSetupMillis/60000);}"/>
>>>>        </actions>
>>>>
>>>> This doesn't do anything.  If I change the actions section to below, I
>>>> get
>>>> a
>>>> "1" when creating a new task, but when editing a task I still just get
>>>> the
>>>> milliseconds.  Obviously when in edit mode it just replaces
>>>> estimatedSetupMillis with whatever is in the database.  I also have a
>>>> feeling that estimatedSetupMillis may not be defined yet in the actions
>>>> section.  How can I make it so I can modify the data before it gets
>>>> displayed?
>>>>
>>>>        <actions>
>>>>            <set field="estimatedSetupMillis" value="1"/>
>>>>        </actions>
>>>>
>>>> Regards,
>>>> Jeremy Olmstead
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>

Re: Modifying Form Data

Posted by Atul Vani <at...@hotwaxmedia.com>.
Hi Jeremy,

how about using it like
<field><display description="${groovy: 
return(estimatedSetupMillis/60000);}"/></field>
or something similar.

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.

Jeremy Olmstead wrote:
> Thanks for the response.  When I change from actions to row-actions I get
> nothing.  Not even the "1" when entering a new routing.  Am I missing
> something?  And yes, I realize this will not update to the database.  I plan
> to intercept UpdateRoutingTask and convert the data back to milliseconds
> before updating.
>
> Jeremy
>
> On Mon, Jul 12, 2010 at 1:35 PM, Adrian Crum <ad...@hlmksw.com> wrote:
>
>   
>> You will need a row action for that. Keep in mind if you change the field's
>> value on the fly like that and the user clicks Save, the wrong value will
>> get saved.
>>
>> -Adrian
>>
>>
>> On 7/12/2010 11:04 AM, Jeremy Olmstead wrote:
>>
>>     
>>> I would like to be able to take data to be displayed in a forms text field
>>> and manipulate it before it is displayed.  How can I do this?  See below
>>> for relevant example code.  Here I want to display estimatedSetupMillis as
>>> minutes instead of milliseconds.
>>>
>>> file: RoutingTaskForms.xml
>>> <form name="EditRoutingTask" target="UpdateRoutingTask"
>>> extends="EditRoutingTask"
>>>
>>> extends-resource="component://manufacturing/widget/manufacturing/RoutingTaskForms.xml">
>>>         <actions>
>>>             <set field="estimatedSetupMillis" value="${groovy:
>>> return(estimatedSetupMillis/60000);}"/>
>>>         </actions>
>>>
>>> This doesn't do anything.  If I change the actions section to below, I get
>>> a
>>> "1" when creating a new task, but when editing a task I still just get the
>>> milliseconds.  Obviously when in edit mode it just replaces
>>> estimatedSetupMillis with whatever is in the database.  I also have a
>>> feeling that estimatedSetupMillis may not be defined yet in the actions
>>> section.  How can I make it so I can modify the data before it gets
>>> displayed?
>>>
>>>         <actions>
>>>             <set field="estimatedSetupMillis" value="1"/>
>>>         </actions>
>>>
>>> Regards,
>>> Jeremy Olmstead
>>>
>>>
>>>       
>
>   

Re: Modifying Form Data

Posted by Jeremy Olmstead <jo...@gmail.com>.
Thanks for the response.  When I change from actions to row-actions I get
nothing.  Not even the "1" when entering a new routing.  Am I missing
something?  And yes, I realize this will not update to the database.  I plan
to intercept UpdateRoutingTask and convert the data back to milliseconds
before updating.

Jeremy

On Mon, Jul 12, 2010 at 1:35 PM, Adrian Crum <ad...@hlmksw.com> wrote:

> You will need a row action for that. Keep in mind if you change the field's
> value on the fly like that and the user clicks Save, the wrong value will
> get saved.
>
> -Adrian
>
>
> On 7/12/2010 11:04 AM, Jeremy Olmstead wrote:
>
>> I would like to be able to take data to be displayed in a forms text field
>> and manipulate it before it is displayed.  How can I do this?  See below
>> for relevant example code.  Here I want to display estimatedSetupMillis as
>> minutes instead of milliseconds.
>>
>> file: RoutingTaskForms.xml
>> <form name="EditRoutingTask" target="UpdateRoutingTask"
>> extends="EditRoutingTask"
>>
>> extends-resource="component://manufacturing/widget/manufacturing/RoutingTaskForms.xml">
>>         <actions>
>>             <set field="estimatedSetupMillis" value="${groovy:
>> return(estimatedSetupMillis/60000);}"/>
>>         </actions>
>>
>> This doesn't do anything.  If I change the actions section to below, I get
>> a
>> "1" when creating a new task, but when editing a task I still just get the
>> milliseconds.  Obviously when in edit mode it just replaces
>> estimatedSetupMillis with whatever is in the database.  I also have a
>> feeling that estimatedSetupMillis may not be defined yet in the actions
>> section.  How can I make it so I can modify the data before it gets
>> displayed?
>>
>>         <actions>
>>             <set field="estimatedSetupMillis" value="1"/>
>>         </actions>
>>
>> Regards,
>> Jeremy Olmstead
>>
>>

Re: Modifying Form Data

Posted by Adrian Crum <ad...@hlmksw.com>.
You will need a row action for that. Keep in mind if you change the 
field's value on the fly like that and the user clicks Save, the wrong 
value will get saved.

-Adrian

On 7/12/2010 11:04 AM, Jeremy Olmstead wrote:
> I would like to be able to take data to be displayed in a forms text field
> and manipulate it before it is displayed.  How can I do this?  See below
> for relevant example code.  Here I want to display estimatedSetupMillis as
> minutes instead of milliseconds.
>
> file: RoutingTaskForms.xml
> <form name="EditRoutingTask" target="UpdateRoutingTask"
> extends="EditRoutingTask"
> extends-resource="component://manufacturing/widget/manufacturing/RoutingTaskForms.xml">
>          <actions>
>              <set field="estimatedSetupMillis" value="${groovy:
> return(estimatedSetupMillis/60000);}"/>
>          </actions>
>
> This doesn't do anything.  If I change the actions section to below, I get a
> "1" when creating a new task, but when editing a task I still just get the
> milliseconds.  Obviously when in edit mode it just replaces
> estimatedSetupMillis with whatever is in the database.  I also have a
> feeling that estimatedSetupMillis may not be defined yet in the actions
> section.  How can I make it so I can modify the data before it gets
> displayed?
>
>          <actions>
>              <set field="estimatedSetupMillis" value="1"/>
>          </actions>
>
> Regards,
> Jeremy Olmstead
>