Login  Register

Re: form widgets

Posted by snowch on Feb 20, 2007; 9:29am
URL: http://ofbiz.116.s1.nabble.com/form-widgets-tp144656p144663.html

This is excellent Scott!

Where else can lists be put into the context for the form?

  - screen definitions (as below)
  - the controller ?
  - the services ?
  - the calling form ?
  - any others ??

It seems that there is a lot of undocumented 'magic' with forms and  
minilang.  Is it easier to use forms if you have been using ofbiz  
since the JSP/FTL and Java based services days when things like  
adding lists to the context had to be done explicitly?

Many thanks,

Chris


On 20 Feb 2007, at 06:27, Scott Gray wrote:

> The most basic example would be to remove the entity-condition in  
> the form and put it inside the actions on the screen definition,  
> then you would add a list-name attribute to the entity-condition like:
> <entity-condition entity-name="Example" list-name="examples">
>
> That will add an entry to the context map with the key "examples"  
> and the value being the list of results.
>
> Regards
> Scott
>
> Christopher Snow wrote:
>> Scott,
>>
>> That's exactly what I was asking - Al, sorry for the confusion!
>>
>> So the list-name attribute is meant to be used when passing a list  
>> "into" the form?
>> Are there any basic examples of how a list may be passed into a form?
>>
>> Many thanks,
>>
>> Chris
>>
>>
>>
>> On 20 Feb 2007, at 04:35, Scott Gray wrote:
>>
>>> Hi Al, Christopher
>>>
>>> Al, I think Christopher is asking why the form still works if he  
>>> removes list-name="examples" from the form element.
>>>
>>> Christopher, as far as I can see having the list-name attribute  
>>> isn't necessary in this case because of the entity-condition  
>>> action (whose results are used regardless of what you do).  Even  
>>> if you passed the form a list called examples, the entity-
>>> condition results would replace it.
>>>
>>> Regards
>>> Scott
>>>
>>> Al Byers wrote:
>>>> Christopher,
>>>>
>>>> I am confused. What is this below:
>>>>
>>>>   <form name="ListExamples" type="list" list-name="examples"
>>>> paginate-target="FindExample"
>>>>
>>>> Did you not see this or am i missing something?
>>>>
>>>> -Al
>>>>
>>>> On 2/19/07, Christopher Snow <[hidden email]> wrote:
>>>>>
>>>>> Al,
>>>>>
>>>>> I'm confused.  The list-name "examples" isn't referred to  
>>>>> anywhere in
>>>>> the form.  In fact, the form works ok without the list-name  
>>>>> attribute in
>>>>> the form.
>>>>>
>>>>> ? :(
>>>>>
>>>>> On Mon, 2007-02-19 at 10:16 -0700, Al Byers wrote:
>>>>> > Christopher,
>>>>> >
>>>>> > In this case the "entity-condition" op gets the list-name  
>>>>> from the
>>>>> "form"
>>>>> > element and puts the list if gets there. And since that is  
>>>>> the variable
>>>>> that
>>>>> > the form expects to find the list info in, it works out.
>>>>> >
>>>>> > -Al
>>>>> >
>>>>> > On 2/19/07, Christopher Snow <[hidden email]> wrote:
>>>>> > >
>>>>> > > I'm struggling with form-widgets:
>>>>> > >
>>>>> > >
>>>>> > > <xs:attribute type="xs:string" name="list-name">
>>>>> > >     <xs:annotation><xs:documentation>for list type and  
>>>>> other multiple
>>>>> > > data/form types this is the name of the list in the context  
>>>>> to iterate
>>>>> > > over</xs:documentation></xs:annotation>
>>>>> > > </xs:attribute>
>>>>> > >
>>>>> > > How does the list get put in the context?  Is it put into  
>>>>> the context
>>>>> by
>>>>> > > <actions> (see below for the example app)?
>>>>> > > Is it redundant in ListExamples as it is not being referred to
>>>>> anywhere?
>>>>> > >
>>>>> > > Many thanks,
>>>>> > >
>>>>> > > Chris
>>>>> > >
>>>>> > >
>>>>> > >     <form name="ListExamples" type="list" list-name="examples"
>>>>> > > paginate-target="FindExample"
>>>>> > >              default-title-style="tableheadtext"
>>>>> > > default-widget-style="tabletext" default-tooltip-
>>>>> style="tabletext">
>>>>> > >         <actions>
>>>>> > >             <entity-condition entity-name="Example">
>>>>> > >                 <order-by field-name="description"/>
>>>>> > >             </entity-condition>
>>>>> > >         </actions>
>>>>> > >
>>>>> > >         <field name="exampleId" title="$
>>>>> {uiLabelMap.ExampleExampleId}"
>>>>> > > widget-style="buttontext">
>>>>> > >             <hyperlink also-hidden="false" description="$
>>>>> {exampleId}"
>>>>> > > target="EditExample?exampleId=${exampleId}"/>
>>>>> > >         </field>
>>>>> > >         <field name="exampleName" title="$
>>>>> {uiLabelMap.CommonName
>>>>> > > }"><display/></field>
>>>>> > >         <field name="exampleTypeId" title="$
>>>>> {uiLabelMap.CommonType
>>>>> }"><display-entity
>>>>> > > entity-name="ExampleType"/></field>
>>>>> > >         <field name="statusId" title="$
>>>>> {uiLabelMap.CommonStatus
>>>>> }"><display-entity
>>>>> > > entity-name="StatusItem"/></field>
>>>>> > >         <field name="description" title="${
>>>>> uiLabelMap.CommonDescription
>>>>> > > }"><display/></field>
>>>>> > >     </form>
>>>>> > >
>>>>> >
>>>>>
>>>>
>>>
>>>
>>> --This message has been scanned for viruses and
>>> dangerous content by MailScanner, and is
>>> believed to be clean.
>>>
>>
>>
>> --This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>>
>>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.