Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Edit form failing to load dependant select boxes

$
0
0
First off I would like to appologise for the lack of code. The code is on a seperate system and I cannot copy onto this one. But I will attempt to describe as best as I can.

I have a dynamic form used for editing records in a grid. The records are based on datasource A. Each record in A has two ids as well as a bunch of other information. The ids are the ids of records in datasource B and datasource C.

Unfortunately I am unable to show any code here but I will attempt to explain my problem.

The dynamic form is set up so that the first selectbox has an optionDataSource(datasource B), key is id from datasource B and name is one of the other fields from datasource A, this has no criteria associated with it and loads all records available to it. This works fine.

The second selectbox has an optionDataSource(datasource C), key and value are from datasource C and the name is set as one of the fields in datasource A. This second selectbox has the getPickListFilterCriteria and getPickListCriteria overridden, taking the value of the first selectbox and using it as a criteria in the the fetch from datasource C.

This all seems to work fine, I am able to create records using this form and I can assign values from both dropdowns. The values also do change in the second dropdown based on the selection in the first.

My problem arises when I goto edit the form. As part of creating the form I call editRecord if the record is not null. The record contains the correct information, it contains the ids of the two items that were selected in the dropdowns but the system fails to load the form as it fails to load from the datasource for the second select box.

I have narrowed this down to when the second selectbox goes to fetch data from its datasource, the criteria have not been set (the ones I set in the getPickListCriteria), this causes a null pointer excpetion when I goto create the url for my data fetch.

How can I make sure the picklist uses any criteria I pass it when populating its list when editing a record? It seems to bypass all the getPickListCriteria methods and so I can't seem to find a way to set the criteria.

Sorry for the lack of code, unfortunately I cannot post it on here as it is all on a seperate system at work.

Viewing all articles
Browse latest Browse all 4756

Trending Articles