+ Start a Discussion
tina sharma 10tina sharma 10 

display length exceeded message for lighning:input

I have a lighting component which has the following

<lightning:input label="Summary" maxlength="50" required="true" value="" aura:id="summary"  onchange="{!c.checkSummaryLength}"
 "/>

if the user enters more than 50 characters, then I want to show a user friendly message saying "EXceeded Lenght Of 50 Characters", just below the the lightning:input.

Please let me know how to do this.

Thanks
Tina


 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Tina,

I found the below developer documentation where in the it is shown how to display a custom error can you please look at it once and check on it.

>> https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_validate_fields.htm

In case if this helped can you please close the thread and mark this as the best answer so that it can be used by others in the future and also helps in keeping our community clean.

Regards,
Anutej
tina sharma 10tina sharma 10
@Anutej
The scenario what u said is based upon clicking a button. But I am looking at the scenario where in the user reaches 50 characters limit and tries to enter further characters then user friendly message should appear.

Regards
Tina
ANUTEJANUTEJ (Salesforce Developers) 
Hi Tina,

I think you can mention a statement above the box ensure the customer can enter upto 50 characters to make sure the customers are aware of the character limit.

I am not sure of the case to show the error before clicking the submit button.

Regards,
Anutej.