+ Start a Discussion
St2018St2018 

How to show error message underneath <apex:inputTextarea> </apex:inputTextarea>?

On my visualforce page I have this.
<apex:inputTextarea value="{!emp.Job_description__c}" styleClass="form-control"/>

In my controller I have this
if (String.isBlank(emp.Job_description__c)) {
                    emp.Job_description__c.addError(System.Label.ValidationEmploymentDescription);
                    doNotsubmit = true;
                }
This works for other fields on my visualforce page except for this one. 
I have a pageMessage on my page and it has the error message above in a box but not under the field.
The message should be displayed under the field and also above in the pageMessage.
Best Answer chosen by St2018
St2018St2018
I ended up changing the  field from textarea to an inputfield 

All Answers

Aman MalikAman Malik
Hi,
Just try to add required attribute in your inputTextArea like below:
<apex:inputTextarea value="{!emp.Job_description__c}" required="true" styleClass="form-control"/>.

Hope this will help.

Please like the answer and mark it best if this helps.

Thanks,
Aman
St2018St2018
Hi I've tried this before and it didn't work. 
Aman MalikAman Malik
Are you submitting your form using commandbutton?
St2018St2018
Yes
St2018St2018
I ended up changing the  field from textarea to an inputfield 
This was selected as the best answer