Populating dropdown list in CAF

Hi,

I am trying to populate the dropdown list in CAF from a document list in web service. It is working fine if the document list contains only one field in it. If the document list contains more than one field in it then how can I achieve this?

Additionally, after selecting a value in the drop-down list, it should dynamically populate other text field in the page with the other corresponding field(with respect to the field selected in the drop-down) in the document list.

Regards,
Suresh.A

Hi
From the list you can generate a “Group of Options from List/Array or Table” that you use in the “Options Group” in the dropdown. You can configure label and value of that provider with the different fields of your list.

To achieve the second part, you may use a Raise On Change control to “raise” an Async Hidden Command, or a Custom Value Change Listener. In the bound java method you can do what you need to.

hope this helps,
Javier

Hi Javier Gallego,

Thanks for the reply. I have created Result Provider for the output>Result in the web service and assigned that result provider to the Option Group, its working fine. But by default it is taking the first field in that list.

The result document list contains about 10-12 fields in it. Need to show one filed(not the first field) in the drop-down label(View in drop-down) and need to assign some other field in the value(Actual value to pick-up).

hi
you chose the wrong element to create the options provider. It is not the “Result” but the element above it.

regards
Javier

Hi Javier Gallego,

I have selected the one told by you and not the one mentioned by me earlier. After creating the provider, I have options like Source Array, Source list, etc… But no where its showing the field names that I want to select. I m directly providing the Result provider in the value field of Option group, in this it is taking the first field by default, but i need to configure some other other than the first one.

Hi Javier Gallego,

That has been achieved. The selection of the field should be done in the Data Binding property of the Result Provider. There are two fields “Label Expression” and “Value Expression” in the Result provider, we need to change the value to the field that we want from the list.

Thanks for your help Javier Gallego.

Regards,
Suresh.A

Hi Suresh/Javier Gallego,

I am new to CAF.

I wrote one IS service and it output is ‘String List’ and i created WS for this and added same to binding section.

May i know how can i populate this ‘StringList’ result as Options for Dropdown by default at runtime when i launch caf page.

From Screen shot, I need to show ProcessList as output for dropdown.

output.PNG

Please find attached
Populating Dropdown list in CAF.docx (195 KB)

Hi Prasad,

Thanks for Quick replay,

Here i am trying IS service for populating ‘StringList’ . And i created WS for that and added to bindings section,

Then followed the steps which you given . But still i am unable to populate data.

Note: Service need to run to get result (No Inputs for service).

Added step by step screen shots which i done.

But still data is not populating.

My IS service.docx (48.7 KB)

Did you make “Auto Refresh” true like I mentioned in the doc for your “Get Process List”? If you set it to TRUE and still not working then either call your webservice connector inside “Initialize” action if you want it to be called only when application is loaded or create a BeforeRenderResponse method and call your webservice inside it to fetch results whenever page is rendered.

Hi Prasad,

I cross checked ‘AutoRefresh’ option. given as true.

i am getting error as 'Failed to evaluate binding expression: “#{ByDateRangeDefaultviewView.getProcessList.result.getProcessListResponse.processList}” ’

when i am loading page.

here my page is on one of ‘Toggle Tabs’.

I tryed to add my WS response in Intialize method as

/ getProcessList.refresh(); but still no luck and error on screen as ‘java.lang.NullPointerException’ (don’t know why :()

And i called beforerender methods as

protected void beforeRenderResponse() {
	// TODO Auto-generated method stub

getProcessList.refresh();
super.beforeRenderResponse();

this one giving error as [POP.001.0002] A “javax.portlet.PortletException” occurred with the Message “at com.webMethods.caf.faces.portlet.FacesPortlet.render(FacesPortlet.java:503)”

:frowning: :frowning:

Hi Naresh,

did you bind the provider to the values property of the drop down list?

You will have to create an OptionGroup which points to the provider.

Regards,
Holger

Yes I made those. I attached screen shots what are the steps I had done.

Please check and let me know if I am missing anything.

My issue got resolved . It was my system environment issue.

Thank you all for quick replay :).