0

Similar to this Post, when i change the namespace in aura component from ui:inputText to lightning:input, I'm getting the following error:

Assertion Failed!: Attribute not defined in the component : false

Below is the code:

Component:

 <lightning:input type = "text" click="{!c.onfocus}" updateOn="keyup" keyup="{!c.keyPressController}"  value="{!v.SearchKeyWord}" placeholder="search.." disabled="{!v.disable}"/>

Controller.js:

onfocus : function(component,event,helper){
        var forOpen = component.find("searchRes");
            $A.util.addClass(forOpen, 'slds-is-open');
            $A.util.removeClass(forOpen, 'slds-is-close');
         var getInputkeyWord = '';
         helper.searchHelper(component,event,getInputkeyWord);
    },
    
keyPressController : function(component, event, helper) {
        var getInputkeyWord = component.get("v.SearchKeyWord");
        if( getInputkeyWord.length > 0 ){
             var forOpen = component.find("searchRes");
               $A.util.addClass(forOpen, 'slds-is-open');
               $A.util.removeClass(forOpen, 'slds-is-close');
            helper.searchHelper(component,event,getInputkeyWord);
        }
        else{  
             component.set("v.listOfSearchRecords", null ); 
             var forclose = component.find("searchRes");
               $A.util.addClass(forclose, 'slds-is-close');
               $A.util.removeClass(forclose, 'slds-is-open');
          }
         
    }

Can anyone please let me know if i missed anything in the above component and controller so that i can get this done.

Thanks!

1 Answer 1

1

Some of the attributes for lightning:input are different from ui:inputText

ui:inputText attribute specification

lightning:input attribute specification

The following attributes from your markup for lightning:input is not supported: click, updateOn and keyup. This is why it is throwing an error.

There are different attributes for handling these changes like: onchange, onblur and onfocus

Edit: Also, the 3 attributes mentioned are not a replacement for the old, they have different implementations. please check the documentation. Each expects a controller action like {!c.}

7
  • now when i change click, updateon and keyup with onchange, onblur and onfocus, I am getting the error as "This page has an error. You might just need to refresh it.". The error is not traced in the debug log as well. Please suggest
    – SK_112
    Aug 10, 2020 at 14:54
  • can you share the updated markup code?
    – webdoctor
    Aug 10, 2020 at 15:45
  • please find the code here: <lightning:input type = "text" onchange="{!c.onfocus}" onblur ="keyup" onfocus="{!c.keyPressController}" value="{!v.SearchKeyWord}" placeholder="search.." disabled="{!v.disable}"/>
    – SK_112
    Aug 10, 2020 at 15:46
  • 1
    Yes. so, in this case, onBlur="keyUp" is not required. OnBlur, Onfocus, and OnChange are 3 different events, each expecting a controller function.
    – webdoctor
    Aug 10, 2020 at 15:48
  • 1
    I found something in slds, but I'm not sure if this is a replacement for ui:scrollerWrapper you need to add the class 'slds-scrollable' <div class="slds-scrollable" style="height:5rem;width:24rem"> </div> reference: lightningdesignsystem.com/utilities/scrollable/…
    – webdoctor
    Aug 11, 2020 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .