0

Component :

            <lightning:textarea aura:id="commentId" name="comments" required="true" value="{!v.case.Comments}"
                                placeholder="Enter comments here"
                                label="Comments"
                                messageWhenValueMissing="Comments required" minLength="3" messageWhenBadInput="Min 3 characters needed"/>

Controller side I am validating this as :

var checkCommentsValid = component.find("commentId");
checkCommentsValid.showHelpMessageIfInvalid();

But still it does not show any message when character is less than 3. Though required field works fine, but minLength does not work.

1

My IDE generated wrong suggestion, it should be minlength="3", with small l.

| improve this answer | |
0

Ligthtning is case sensitive as per docs use minlength instead minLength use small cases

        <lightning:textarea aura:id="commentId" name="comments" required="true" value="{!v.case.Comments}"
                            placeholder="Enter comments here"
                            label="Comments"
                            messageWhenValueMissing="Comments required" minLength="3" messageWhenBadInput="Min 3 characters needed"/>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.