How can I read out values from a form that contains dynamically created elements [message #1033718] |
Thu, 04 April 2013 11:04  |
Eclipse User |
|
|
|
I'm creating a form (called GenericForm) which is going to allow the user to set parameters for the generation of reports. The form is going to contain an unknown amount of elements. These elements are being created on the form using a override of the InjectFieldsInternal function, showing here:
@Override
protected void injectFieldsInternal(List<IFormField> fieldList) {
List<ReportParameter> metadata = null;
if (reportId != null)
{
metadata = SERVICES.getService(IReportingService.class).getMetadataFromReport(reportId);
}
IFieldConstructorService constructService = SERVICES.getService(IFieldConstructorService.class);
Iterator<ReportParameter> metait = metadata.iterator();
while (metait.hasNext())
{
ReportParameter rp = metait.next();
if (rp.getName().equals("Unit"))
{
rp = metait.next();
}
String dataType = rp.getDataType();
switch (dataType)
{
case "date":
fieldList.add(constructService.AbstractDateField(rp.getName(), 0, true));
break;
case "string":
fieldList.add(constructService.AbstractStringField(rp.getName(), 0, true));
break;
default:
break;
}
}
fieldList.add(constructService.DefaultUnitBox());
fieldList.add(constructService.DefaultReportFormBox());
}
Normally when handeling the data from the form after the user is done with giving its preferred parameterdata, I would use the exportFormData function in the Handler to chuck it in a formData value, and then handle it from there.
public class ReportHandler extends AbstractFormHandler {
@Override
public void execLoad() throws ProcessingException {
}
@Override
public void execStore() throws ProcessingException {
GenericFormData formData = new GenericFormData();
exportFormData(formData); //formData remains to be empty
//Further handeling of formData
}
However, since I got dynamically created elements in GenericForm, they dont show up in my GenericFormData class which is used by the exportFormData function. Which in turn doesnt export the values from the form into the formData value. Atleast, if I understand it correctly.
Is there another way to get the data from the form, or am I tasked with somehow (temporarily) populating my GenericFormData class with the information required for scout to fill out the formData value via the exportFormData function?
|
|
|
|
|
Re: How can I read out values from a form that contains dynamically created elements [message #1729685 is a reply to message #1033718] |
Mon, 18 April 2016 03:03  |
Eclipse User |
|
|
|
I am using wrappedfield in a search form to load a form with dynamic elements and collecting dynamic field labels and values in a list as directed in this thread, but I dont get idea to pass this List to search form FORMDATA/service, can it be guided, please?
I need guidance to manually write/override the import/export Formdata functions to pass the data from inner form(using wrappedfield) to outer/parent form.
Loading/setting of the inner form is invoked from a Button's ExecClickAction() of SearchForm,
MyForm form = new MyForm(param);
form.setIconId(Icons.Download);
getWrapField().setInnerForm(form);
form.setHandler(new SearchHandler());
form.initForm();
In the MyForm, the GUI fields are loaded dynamically using injectFieldsInternal(OrderedCollection<IFormField> fieldList) function,
Now inner form is getting loaded with the dynamic elements from database, and now need to pass back the GUI field input values to searchform for the further processing, guide plz.
Thanks in advance
|
|
|
Powered by
FUDForum. Page generated in 0.04628 seconds