Unable to get error indicator next to field caption for Custom Validation

Hi All,

I am using MVP(Model View Presenter) pattern in my application. I am doing custom validation for Custom Form which uses FieldFactory.

public MeasurementResultForm() {
		
		setImmediate(true);
		setFormFieldFactory(new MeasurementsResultsFormFieldFactory());
		setValidationVisible(true);
	        setComponentError(null);
		setMeasurementForm(); // where am setting ItemDataSource
		
	}

I am using Custom validation under ValueChangeEvent in Presenter for some fields in the above form.

public void valueChange(ValueChangeEvent event) {

	// on validation
       
           form.setComponentError(CustomErrorMessage);
     }

Anyhow am successfully displayed error message in the space for component error with error indicator label but am fail to display error indicators in the fields where validation failed.
I have tried by calling form.commit() under valueChangeEvent() but no luck in displaying error indicator. Any help is highly appreciated and thanks in advance.

Well, I’m not sure if I understand the problem correctly, but don’t you have to set the componentError on the Field where the error occured instead onto the form?
Somethin like textfield.setComponentError(new UserError(customErrorMessage));

thanks Marcel Hallmann, i could be able to display error indicator next to Field caption.