Background
HTML select elements are auto filled by checking for dependents of previously filled elements.
For example if a form contains both a Category and a Subcategory input, and the Subcategory
entity has a relationship with the Category entity, then when a Category option is selected
in the HTML form, the Subcategory input is automatically populated by running query of
the form SELECT * FROM Subcategory WHERE Category = ?.
The above logic is handled by com.looseboxes.webform.form.DependentsProviderImpl.
Dependents were not appropriately provided as expected.
Problem
For com.looseboxes.webform.form.DependentsProviderImpl to execute the necessary query,
form inputs are often converted from String to the appropriate type using logic of format.
DomainTypeConverter converter;
if(converter.isConvertible(String.class, propertyClass)) {
converter.convert(propertyValue, String.class, propertyClass);
}
converter.isConvertible from the above code returns false when true is expected.
Temporary Solution
We are manually converting. If the value is a number type, we assume it represents
the ordinal of an enum/ID of an entity and we attempt to use the value to find the
corresponding enum/entity.
Background
HTML select elements are auto filled by checking for dependents of previously filled elements.
For example if a form contains both a
Categoryand aSubcategoryinput, and theSubcategoryentity has a relationship with the
Categoryentity, then when aCategoryoption is selectedin the HTML form, the
Subcategoryinput is automatically populated by running query ofthe form
SELECT * FROM Subcategory WHERE Category = ?.The above logic is handled by
com.looseboxes.webform.form.DependentsProviderImpl.Dependents were not appropriately provided as expected.
Problem
For
com.looseboxes.webform.form.DependentsProviderImplto execute the necessary query,form inputs are often converted from String to the appropriate type using logic of format.
converter.isConvertiblefrom the above code returnsfalsewhentrueis expected.Temporary Solution
We are manually converting. If the value is a number type, we assume it represents
the ordinal of an enum/ID of an entity and we attempt to use the value to find the
corresponding enum/entity.