+ Start a Discussion

conversion error in dynamic inputfield


I'm trying to create a dynamic filter where the user can select any fields from a SObject to filter the data (something like the lookup filters). It is working fine, however, the below scenario throws an error:
If the inputField is having a previous value selected (say a String) and I selected a DateTime field in the filter, it tried to convert the string into DateTime and throwing a error. Below is the line in question:
<apex:inputField value="{!inputObj[FieldName]}" required="false" rendered="true" style="width:50%"/>
Getting the below error:.
Error: Value 'Provisional' cannot be converted from Text to DateTime
FieldName refers to the field API name. Any ideas on how to solve this would be very much appreciated.

Nitish KumarNitish Kumar
I think the best solution would be to clear the selected value whenever you are changing the filter criteria (changing the fields)
Thanks for replying Nitish. However, since I'm using a dynamic binding in the object, not able to clear off the field. Any help on this will be greatly helpful.