+ Start a Discussion

Required Field validation on Dynamic VF page.


I have 3 custom objects.

Object1:- It contains fields as Name (Auto), FieldName__c (Text), ObjectName__c(Text).

Name     FieldName__c            ObjectName__c

1 Item__c(lookup) object2

2             Color__c(Text)              object2

3             Size__c(Text)                 object2

like this i entered records.

Object3: It Contains fields as Name(auto), Item__c(Text), Required__c(Text).

Name         Item__c           Required__c

1 AC Color



With "object1" i constructed a new VF page dynamically using Wrapper class Functionality.

Initially all the fields on DVF is not required. This page Contains Item__c (lookup), color__c, Size__c fields and save button.

Now select Item__c value (AC) from the lookup then save.

Per Item "AC" Color is required. Here Color value is null.

So, i need to make that color field as required field with Red (Just like standard salesforce functionality).

Like this i need to perform the validation on my Dynamic VF page.



Please suggest me.






Typically if you're using a custom controller, you'll need to do your field validation on the client using Javascript or similar.  I think that if you're using a standard controller, you have access to the default validation behavior.  With your use case, though, I'm not sure that'll work.