Skip to main content
Hi Guys!, I'm using ui:InputTextArea in my lightning component. I want to put validation on it so that the field should not be empty. It is a required field. However when I enter a space it is allowing to save. Anyone have any idea on how I can put empty validation on ui:InputTextArea?

 

Thanks!
11 个回答
  1. 2018年11月13日 16:23

    I see! In that case you will need to do something like this:

    var FieldValue = component.find("auraId").get("v.value");

    var str=FieldValue.replace(/ /g, '')); // This will remove all the spaces in the string.

    if($A.util.isEmpty(str)){

    }

     

     
0/9000