I am facing a very strange error when applying change event on UI:InputText that is inside Aura:Iteration. When I focus out of the Input it throws me below error.

This page has an error. You might just need to refresh it. afterRender threw an error in ui:inputText' [(a || s).replace is not a function] Failing descriptor: {ui:inputText}

<aura:iteration items="{!v.optionWrapper.opportunityLineItemSchedules}" var="opportunityLineItemSchedule" indexVar="index">
                    <div class="row" style="min-height:18px !important;"> 
                        <div class="col-md-3"><ui:outputText value="{!opportunityLineItemSchedule.ScheduleDate}"/></div>
                        <div class="col-md-1" >&nbsp;</div>
                        <div class="col-md-2"><ui:inputText value="{!opportunityLineItemSchedule.Quantity}" class="{!index}" labelClass="{!index}" blur="{!c.handleRampingChange}"/></div>
                        <div class="col-md-1" >&nbsp;</div>
                        <div class="col-md-2"><ui:inputText value="{!opportunityLineItemSchedule.Revenue}" labelClass="{!index}" /></div>

handleRampingChange : function(component, event, helper) {
        var labelclass = event.getSource.get("v.label");
        console.log('at 42 '+labelclass);
        for(var i=0; i < optionWrapper.opportunityLineItemSchedules.length; i++) 
             console.log('at 42 '+labelclass);
  • can you share the controller method that is fired?
    – glls
    Jun 26, 2018 at 15:18
  • Sure. I`ll add that. There is not much in that though Jun 26, 2018 at 15:26
  • Your problem seems to be rooting from class="{!index}" why would you set the class and labelclass on the inputtext to a indexvar variable? In my opinion these need to refer to a css element and not a random string(thoughts?)
    – Rao
    Jun 26, 2018 at 17:21
  • These are attributes that was doing a trial and error method just to see which attribute is accessed in the javascript controller so that I can use the index value to build additional logic. Jun 28, 2018 at 20:08


You must log in to answer this question.