function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sachin Bhalerao 17Sachin Bhalerao 17 

How to set Minlength and Max length in lightning input textarea?

Dear Team ,

Plz let me know How to set Minlength and Max length in lightning input textarea?

Thanks & Regards
Sachin Bhalerao
 
ChinnoyChinnoy
Hey Sachin,

Try the code something like this.

<lightning:input maxlength="255" 
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi sachin,
In lightning:textarea component we have maxlength,minlength attributes which allows you specify number of character allowed.
<lightning:textarea name="input6" required="true" value="initial value" label="Required textarea field with a maximum length of 60 characters" maxlength="60" minlength = "5"/>
Please refer below link which might help you further
https://developer.salesforce.com/docs/component-library/bundle/lightning:textarea/example

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards

 
Ajay K DubediAjay K Dubedi
Hi Sachin,

* Try below code's line:
<div class="slds-size_1-of-3">
        <lightning:input type="Text" name="input1" placeholder="Client or partner name" />
    </div
 
* you can change size as 2-of-3 for the medium size text area

* Please take reference from below link:

    https://www.lightningdesignsystem.com/utilities/sizing/

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
Deepali KulshresthaDeepali Kulshrestha
Hi Sachin,

I have gone through your question. To given the maxlength in the there standard defined function in lightning:inputTextarea tag.

maxlength  ---> Type--->integer    global        
Description--->    The maximum number of characters that can be typed into the input field. 
                Corresponds to the maxlength attribute of the rendered HTML Textarea element.

Example:--

<ui:inputTextArea aura:id="comments" label="Comments"  value="My comments" rows="5"  maxlength="255"/>
 

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com