0

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>
                    </div>
</aura:iteration>

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 '18 at 15:18
  • Sure. I`ll add that. There is not much in that though – Shiva Achukatla Jun 26 '18 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 '18 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. – Shiva Achukatla Jun 28 '18 at 20:08

Your Answer

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

Browse other questions tagged or ask your own question.