Failing to populate list-option

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

Failing to populate list-option

Foo Shyn Chung
Hi guys,

Just to check, anyone has an idea on how to populate a dropdown list with
the result from getAssociatedStateList in the Form Widget xml?

The scenario is that i just need the dropdown box to populate the states of
a particular country, thus i do not need the full ajax implementation as
mentioned in the example form.

Currently i have the Form in single mode and actions tag that calls the
service,

<form name="MembersForm" target="addMember" type="single"
default-title-style="tableheadtext" default-tooltip-style="tabletext"
default-widget-style="inputBox" >
    <actions>
      <service service-name="getAssociatedStateList" result-map="result">
          <field-map name="countryGeoId" value="MYS"/>
      </service>
    </actions>

      <field name="states">
        <drop-down allow-empty="true">
         <list-options key-name="countryGeoId" list-name="result.stateList"
description="${countryGeoId}"  />
      </drop-down>
    </field>
    ....
  </form>

I got an error that states "Not a map"

Anyone has any clue?

Thanx
FooShyn
Reply | Threaded
Open this post in threaded view
|

Re: Failing to populate list-option

Jacques Le Roux
Administrator
What do you have in log? (just a relevant snippet)

Jacques

From: "Foo Shyn Chung" <[hidden email]>

> Hi guys,
>
> Just to check, anyone has an idea on how to populate a dropdown list with
> the result from getAssociatedStateList in the Form Widget xml?
>
> The scenario is that i just need the dropdown box to populate the states of
> a particular country, thus i do not need the full ajax implementation as
> mentioned in the example form.
>
> Currently i have the Form in single mode and actions tag that calls the
> service,
>
> <form name="MembersForm" target="addMember" type="single"
> default-title-style="tableheadtext" default-tooltip-style="tabletext"
> default-widget-style="inputBox" >
>    <actions>
>      <service service-name="getAssociatedStateList" result-map="result">
>          <field-map name="countryGeoId" value="MYS"/>
>      </service>
>    </actions>
>
>      <field name="states">
>        <drop-down allow-empty="true">
>         <list-options key-name="countryGeoId" list-name="result.stateList"
> description="${countryGeoId}"  />
>      </drop-down>
>    </field>
>    ....
>  </form>
>
> I got an error that states "Not a map"
>
> Anyone has any clue?
>
> Thanx
> FooShyn
>
Reply | Threaded
Open this post in threaded view
|

Re: Failing to populate list-option

Foo Shyn Chung
I got the following from the log:

Sync service [marketingofficer/getAssociatedStateList] finished in [953]
milliseconds with response [{stateList={Johor: MY-JHR, Kedah: MY-KDH,
Kelantan: MY-KTN, Wilayah Persekutuan Kuala Lumpur: MY-KUL, Wilayah
Persekutuan Labuan: MY-LBN, Melaka: MY-MLK, Negeri Sembilan: MY-NSN,
Pahang: MY-PHG, Wilayah Persekutuan Putrajaya: MY-PJY, Perlis: MY-PLS,
Pulau Pinang: MY-PNG, Perak: MY-PRK, Sabah: MY-SBH, Selangor: MY-SGR,
Sarawak: MY-SWK, Terengganu: MY-TRG}, responseMessage=success}]
2011-12-20 14:30:32,843 (http-0.0.0.0-8443-1) [
ModelScreen.java:401:ERROR] Error rendering screen
[component://common/widget/CommonScreens.xml#GlobalDecorator]:
java.lang.ClassCastException: Not a map. Rolling back transaction.

From there i can see that the service call was successful, however it
failed when rendering the screen.

I think it is because the service result is not a Map and it's a List
instead? if that's the case is there anyway i can encapsulate the result
into a Map in the xml and use it as i intended to to generate the option
list?

Thanx a lot
FooShyn


On Tue, Dec 20, 2011 at 7:05 AM, Jacques Le Roux <
[hidden email]> wrote:

> What do you have in log? (just a relevant snippet)
>
> Jacques
>
> From: "Foo Shyn Chung" <[hidden email]>
>
>  Hi guys,
>>
>> Just to check, anyone has an idea on how to populate a dropdown list with
>> the result from getAssociatedStateList in the Form Widget xml?
>>
>> The scenario is that i just need the dropdown box to populate the states
>> of
>> a particular country, thus i do not need the full ajax implementation as
>> mentioned in the example form.
>>
>> Currently i have the Form in single mode and actions tag that calls the
>> service,
>>
>> <form name="MembersForm" target="addMember" type="single"
>> default-title-style="**tableheadtext" default-tooltip-style="**tabletext"
>> default-widget-style="**inputBox" >
>>   <actions>
>>     <service service-name="**getAssociatedStateList" result-map="result">
>>         <field-map name="countryGeoId" value="MYS"/>
>>     </service>
>>   </actions>
>>
>>     <field name="states">
>>       <drop-down allow-empty="true">
>>        <list-options key-name="countryGeoId" list-name="result.stateList"
>> description="${countryGeoId}"  />
>>     </drop-down>
>>   </field>
>>   ....
>>  </form>
>>
>> I got an error that states "Not a map"
>>
>> Anyone has any clue?
>>
>> Thanx
>> FooShyn
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Failing to populate list-option

Jacques Le Roux
Administrator
Keep it simple, use

<field name="geoId">
    <drop-down allow-empty="true">
        <entity-options entity-name="GeoAssocAndGeoToWithState" description="${geoName}">
            <entity-constraint name="geoIdFrom" value="MYS"/>
        </entity-options>
    </drop-down>
</field>

Jacques

From: "Foo Shyn Chung" <[hidden email]>

>I got the following from the log:
>
> Sync service [marketingofficer/getAssociatedStateList] finished in [953]
> milliseconds with response [{stateList={Johor: MY-JHR, Kedah: MY-KDH,
> Kelantan: MY-KTN, Wilayah Persekutuan Kuala Lumpur: MY-KUL, Wilayah
> Persekutuan Labuan: MY-LBN, Melaka: MY-MLK, Negeri Sembilan: MY-NSN,
> Pahang: MY-PHG, Wilayah Persekutuan Putrajaya: MY-PJY, Perlis: MY-PLS,
> Pulau Pinang: MY-PNG, Perak: MY-PRK, Sabah: MY-SBH, Selangor: MY-SGR,
> Sarawak: MY-SWK, Terengganu: MY-TRG}, responseMessage=success}]
> 2011-12-20 14:30:32,843 (http-0.0.0.0-8443-1) [
> ModelScreen.java:401:ERROR] Error rendering screen
> [component://common/widget/CommonScreens.xml#GlobalDecorator]:
> java.lang.ClassCastException: Not a map. Rolling back transaction.
>
> From there i can see that the service call was successful, however it
> failed when rendering the screen.
>
> I think it is because the service result is not a Map and it's a List
> instead? if that's the case is there anyway i can encapsulate the result
> into a Map in the xml and use it as i intended to to generate the option
> list?
>
> Thanx a lot
> FooShyn
>
>
> On Tue, Dec 20, 2011 at 7:05 AM, Jacques Le Roux <
> [hidden email]> wrote:
>
>> What do you have in log? (just a relevant snippet)
>>
>> Jacques
>>
>> From: "Foo Shyn Chung" <[hidden email]>
>>
>>  Hi guys,
>>>
>>> Just to check, anyone has an idea on how to populate a dropdown list with
>>> the result from getAssociatedStateList in the Form Widget xml?
>>>
>>> The scenario is that i just need the dropdown box to populate the states
>>> of
>>> a particular country, thus i do not need the full ajax implementation as
>>> mentioned in the example form.
>>>
>>> Currently i have the Form in single mode and actions tag that calls the
>>> service,
>>>
>>> <form name="MembersForm" target="addMember" type="single"
>>> default-title-style="**tableheadtext" default-tooltip-style="**tabletext"
>>> default-widget-style="**inputBox" >
>>>   <actions>
>>>     <service service-name="**getAssociatedStateList" result-map="result">
>>>         <field-map name="countryGeoId" value="MYS"/>
>>>     </service>
>>>   </actions>
>>>
>>>     <field name="states">
>>>       <drop-down allow-empty="true">
>>>        <list-options key-name="countryGeoId" list-name="result.stateList"
>>> description="${countryGeoId}"  />
>>>     </drop-down>
>>>   </field>
>>>   ....
>>>  </form>
>>>
>>> I got an error that states "Not a map"
>>>
>>> Anyone has any clue?
>>>
>>> Thanx
>>> FooShyn
>>>
>>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Failing to populate list-option

Foo Shyn Chung
I didn't have this view in my project as i got the version 11 from the
branch release instead of trunk. However after i imported the relevant
entity and data from trunk, it's now working!

Thanx for the help!
FooShyn

On Tue, Dec 20, 2011 at 6:44 PM, Jacques Le Roux <
[hidden email]> wrote:

> Keep it simple, use
>
> <field name="geoId">
>   <drop-down allow-empty="true">
>       <entity-options entity-name="**GeoAssocAndGeoToWithState"
> description="${geoName}">
>           <entity-constraint name="geoIdFrom" value="MYS"/>
>       </entity-options>
>   </drop-down>
> </field>
>
>
> Jacques
>
> From: "Foo Shyn Chung" <[hidden email]>
>
>> I got the following from the log:
>>
>> Sync service [marketingofficer/**getAssociatedStateList] finished in
>> [953]
>> milliseconds with response [{stateList={Johor: MY-JHR, Kedah: MY-KDH,
>> Kelantan: MY-KTN, Wilayah Persekutuan Kuala Lumpur: MY-KUL, Wilayah
>> Persekutuan Labuan: MY-LBN, Melaka: MY-MLK, Negeri Sembilan: MY-NSN,
>> Pahang: MY-PHG, Wilayah Persekutuan Putrajaya: MY-PJY, Perlis: MY-PLS,
>> Pulau Pinang: MY-PNG, Perak: MY-PRK, Sabah: MY-SBH, Selangor: MY-SGR,
>> Sarawak: MY-SWK, Terengganu: MY-TRG}, responseMessage=success}]
>> 2011-12-20 14:30:32,843 (http-0.0.0.0-8443-1) [
>> ModelScreen.java:401:ERROR] Error rendering screen
>> [component://common/widget/**CommonScreens.xml#**GlobalDecorator]:
>> java.lang.ClassCastException: Not a map. Rolling back transaction.
>>
>> From there i can see that the service call was successful, however it
>> failed when rendering the screen.
>>
>> I think it is because the service result is not a Map and it's a List
>> instead? if that's the case is there anyway i can encapsulate the result
>> into a Map in the xml and use it as i intended to to generate the option
>> list?
>>
>> Thanx a lot
>> FooShyn
>>
>>
>> On Tue, Dec 20, 2011 at 7:05 AM, Jacques Le Roux <
>> [hidden email]> wrote:
>>
>>  What do you have in log? (just a relevant snippet)
>>>
>>> Jacques
>>>
>>> From: "Foo Shyn Chung" <[hidden email]>
>>>
>>>  Hi guys,
>>>
>>>>
>>>> Just to check, anyone has an idea on how to populate a dropdown list
>>>> with
>>>> the result from getAssociatedStateList in the Form Widget xml?
>>>>
>>>> The scenario is that i just need the dropdown box to populate the states
>>>> of
>>>> a particular country, thus i do not need the full ajax implementation as
>>>> mentioned in the example form.
>>>>
>>>> Currently i have the Form in single mode and actions tag that calls the
>>>> service,
>>>>
>>>> <form name="MembersForm" target="addMember" type="single"
>>>> default-title-style="****tableheadtext" default-tooltip-style="****
>>>> tabletext"
>>>> default-widget-style="****inputBox" >
>>>>  <actions>
>>>>    <service service-name="****getAssociatedStateList"
>>>> result-map="result">
>>>>
>>>>        <field-map name="countryGeoId" value="MYS"/>
>>>>    </service>
>>>>  </actions>
>>>>
>>>>    <field name="states">
>>>>      <drop-down allow-empty="true">
>>>>       <list-options key-name="countryGeoId" list-name="result.stateList"
>>>> description="${countryGeoId}"  />
>>>>    </drop-down>
>>>>  </field>
>>>>  ....
>>>>  </form>
>>>>
>>>> I got an error that states "Not a map"
>>>>
>>>> Anyone has any clue?
>>>>
>>>> Thanx
>>>> FooShyn
>>>>
>>>>
>>>>
>>