2

I'm trying to create and include in my parent component a subcomponent through the method $A.createComponent() but it throws a strange exception. This is a piece of the code of my parent component:

<aura:component access="GLOBAL" extensible="true" implements="force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes,forceCommunity:availableForAllPageTypes" controller="Controller">
    <table>
       {!v.body}
    </table>
    <lightning:button aura:id="newBtn" class="newButton" variant="brand" label="Nuovo" iconName="utility:new" onclick="{!c.insertNewRow}" />
</aura:component>

This is the parent's controller method that creates the subcomponent:

insertNewRow : function(cmp, event, helper) {
        $A.createComponent("c:OrganizeEnvelopeRow", {},
            function(component, status, errorMessage){
                if (status === "SUCCESS") {
                    console.log(status);
                    try {
                        var body = cmp.get("v.body");
                        body.push(component);
                        cmp.set("v.body", body);
                        cmp.find("newBtn").set("v.disabled", true);
                    }
                    catch(err) {
                        console.log('Errore: ' + err);
                    }
                }
                else if (status === "INCOMPLETE") {
                    console.log("No response from server or client is offline.")
                }
                else if (status === "ERROR") {
                    console.log("Error: " + errorMessage);
                }
            }
         );
    },

And here is the subcomponent code:

<aura:component access="GLOBAL">
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<tr>
    <td>
        <lightning:input aura:id="nomeDoc" label=" " />
    </td>
    <td>
        <lightning:select name="select" label=" ">
            <option value="TBD" text="TBD"></option>
        </lightning:select>
    </td>
    <td>
        <lightning:select name="select" label=" ">
            <option value="TBD" text="TBD"></option>
        </lightning:select>
    </td>
    <td>
        <lightning:button name="signerButton" class="signerButtons" tabindex="{!index}" label="" iconName="standard:people" iconPosition="left" variant="brand" />
    </td>
    <td>
        <lightning:input aura:id="file" type="file" label=" " name="file" multiple="true" accept=".pdf, .doc, .docx" onchange="{!c.save}" />
    </td>
    <td>
        <lightning:button name="delete" tabindex="{!index}" class="deleteButtons" variant="destructive" label="" iconName="utility:delete" iconPosition="left" disabled="true" onclick="{!c.deleteRow}" />
        <lightning:button name="save" tabindex="{!index}" class="saveButtons" variant="brand" label="" iconName="utility:download" iconPosition="left" disabled="true"/>
    </td>
</tr>
</aura:component>

Finally, this is the exception:

org.auraframework.throwable.quickfix.MissingRequiredAttributeException: COMPONENT markup://OrganizeEnvelopeRow is missing required attribute 'name'
    at .(///home/sfdc/installed/sfdc-base__206_prod__13413847_Linux.x86_64.prod.runtime.app_sfdc-base/salesforce/ui-lightning-components/components/lightning/inputable/inputable.intf:19)
    at .(markup://lightning:input:1)
    at .(markup://Bit2Sign:OrganizeEnvelopeRow.$:1)
    at .(markup://aura:component.body[0]:1)
    at .(markup://aura:html.body[0]:1)
    at .(markup://aura:html.body[0]:1)
    at .(///home/sfdc/installed/sfdc-base__206_prod__13413847_Linux.x86_64.prod.runtime.app_sfdc-base/salesforce/ui-lightning-components/components/lightning/inputable/inputable.intf:19)
    at org.auraframework.impl.root.component.BaseComponentImpl.validateAttributes(BaseComponentImpl.java:284)
    at org.auraframework.impl.root.component.BaseComponentImpl.finishInit(BaseComponentImpl.java:251)
    at org.auraframework.impl.root.component.ComponentImpl.finishInit(ComponentImpl.java:165)
    at org.auraframework.impl.root.component.BaseComponentImpl.<init>(BaseComponentImpl.java:141)
    at org.auraframework.impl.root.component.ComponentImpl.<init>(ComponentImpl.java:56)
    at org.auraframework.impl.InstanceServiceImpl.getInstance(InstanceServiceImpl.java:149)
    at org.auraframework.impl.type.ComponentArrayTypeDef.initialize(ComponentArrayTypeDef.java:111)
    at org.auraframework.impl.root.AttributeSetImpl.set(AttributeSetImpl.java:168)
    at org.auraframework.impl.root.AttributeSetImpl.set(AttributeSetImpl.java:182)
    at org.auraframework.impl.root.component.BaseComponentImpl.<init>(BaseComponentImpl.java:140)
    at org.auraframework.impl.root.component.ComponentImpl.<init>(ComponentImpl.java:56)
    at org.auraframework.impl.InstanceServiceImpl.getInstance(InstanceServiceImpl.java:149)
    at org.auraframework.impl.type.ComponentArrayTypeDef.initialize(ComponentArrayTypeDef.java:111)
    at org.auraframework.impl.root.AttributeSetImpl.set(AttributeSetImpl.java:168)
    at org.auraframework.impl.root.AttributeSetImpl.set(AttributeSetImpl.java:182)
    at org.auraframework.impl.root.component.BaseComponentImpl.<init>(BaseComponentImpl.java:140)
    at org.auraframework.impl.root.component.ComponentImpl.<init>(ComponentImpl.java:56)
    at org.auraframework.impl.InstanceServiceImpl.getInstance(InstanceServiceImpl.java:149)
    at org.auraframework.impl.type.ComponentArrayTypeDef.initialize(ComponentArrayTypeDef.java:111)
    at org.auraframework.impl.root.AttributeSetImpl.set(AttributeSetImpl.java:168)
    at org.auraframework.impl.root.AttributeSetImpl.set(AttributeSetImpl.java:208)
    at org.auraframework.impl.root.component.BaseComponentImpl.<init>(BaseComponentImpl.java:159)
    at org.auraframework.impl.root.component.ComponentImpl.<init>(ComponentImpl.java:75)
    at org.auraframework.impl.root.component.ComponentImpl.createSuper(ComponentImpl.java:68)
    at org.auraframework.impl.root.component.BaseComponentImpl.finishInit(BaseComponentImpl.java:248)
    at org.auraframework.impl.root.component.ComponentImpl.finishInit(ComponentImpl.java:165)
    at org.auraframework.impl.root.component.BaseComponentImpl.<init>(BaseComponentImpl.java:109)
    at org.auraframework.impl.root.component.ComponentImpl.<init>(ComponentImpl.java:51)
    at org.auraframework.impl.instance.ComponentInstanceBuilder.getInstance(ComponentInstanceBuilder.java:46)
    at org.auraframework.impl.instance.ComponentInstanceBuilder.getInstance(ComponentInstanceBuilder.java:31)
    at org.auraframework.impl.InstanceServiceImpl.getInstance(InstanceServiceImpl.java:127)
    at org.auraframework.impl.InstanceServiceImpl.getInstance(InstanceServiceImpl.java:107)
    at org.auraframework.impl.controller.ComponentController.getBaseComponent(ComponentController.java:219)
    at org.auraframework.impl.controller.ComponentController.getComponent(ComponentController.java:235)
    at sun.reflect.GeneratedMethodAccessor3203.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.auraframework.impl.java.controller.JavaAction.run(JavaAction.java:147)
    at org.auraframework.impl.ServerServiceImpl.run(ServerServiceImpl.java:202)
    at org.auraframework.impl.ServerServiceImpl.run(ServerServiceImpl.java:152)
    at org.auraframework.http.AuraServlet.doPost(AuraServlet.java:513)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
    at org.eclipse.jetty9.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1693)
    at system.filter.AuraDomainRedirectFilter.doFilter(AuraDomainRedirectFilter.java:82)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at aura.impl.http.SFDCAuraContextFilter.doFilter(SFDCAuraContextFilter.java:184)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.useragent.CommonUserAgentRewriteFilter.doFilter(CommonUserAgentRewriteFilter.java:27)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at klein9.filter.JettyStreamWriterAdaptorFilter.doFilter(JettyStreamWriterAdaptorFilter.java:107)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.cookie.CookieCatalogFilter.doFilter(CookieCatalogFilter.java:68)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.vulnerability.CommonVulnerabilityCheckFilter.doFilter(CommonVulnerabilityCheckFilter.java:68)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.SeparateDomainRedirectFilter.doFilter(SeparateDomainRedirectFilter.java:155)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.dns.filter.CustomDomainMappingFilter.doFilter(CustomDomainMappingFilter.java:221)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.dns.filter.SiteRedirectMappingFilter.doFilter(SiteRedirectMappingFilter.java:114)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.dns.filter.BandwidthMeterFilter.doFilter(BandwidthMeterFilter.java:125)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.OrgDomainFilter.doFilter(OrgDomainFilter.java:59)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.StatsOnlyFilter.doFilter(StatsOnlyFilter.java:85)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.BasePreGzipFilter.doFilter(BasePreGzipFilter.java:198)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.RedirectFilter.doFilter(RedirectFilter.java:222)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.modifyparam.ModifiableParameterFilter.doFilter(ModifiableParameterFilter.java:47)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at klein9.filter.MultiPartFilter.doFilter(MultiPartFilter.java:119)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at com.force.http.routing.RoutingFilter.doFilter(RoutingFilter.java:72)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.InstanceRedirectFilter.doFilter(InstanceRedirectFilter.java:824)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.routing.CommonRemoteAddrFilter.doFilter(CommonRemoteAddrFilter.java:75)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.LegacyJSPFilter.doFilter(LegacyJSPFilter.java:219)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at routing.ios.IosRoutingFilter.doFilter(IosRoutingFilter.java:85)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.feeds.notification.tracking.ClickTrackingFilter.doFilter(ClickTrackingFilter.java:84)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.dns.filter.SitesRuntimeForwardingFilter.requestIsNotForSites(SitesRuntimeForwardingFilter.java:181)
    at core.dns.filter.SitesRuntimeForwardingFilter.doFilterInternal(SitesRuntimeForwardingFilter.java:398)
    at core.dns.filter.SitesRuntimeForwardingFilter.doFilter(SitesRuntimeForwardingFilter.java:221)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.dns.filter.SitesProxyCachingFilter.doFilter(SitesProxyCachingFilter.java:45)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at routing.filter.LoadBalancerFilter.doFilter(LoadBalancerFilter.java:80)
    at routing.loadbalancer.SfdcLoadBalancerFilter.doFilter(SfdcLoadBalancerFilter.java:54)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at common.util.database.ZeroDowntimeSpinModeFilter.doFilter(ZeroDowntimeSpinModeFilter.java:62)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.orgdomain.OrgDomainLoadBalancerFilter.doFilter(OrgDomainLoadBalancerFilter.java:88)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.context.CommonStackableContextWatchingFilter.doFilter(CommonStackableContextWatchingFilter.java:207)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.context.CommonContextReleaseFilter.doFilter(CommonContextReleaseFilter.java:75)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.SessionNeverEstablishedLogFilter.doFilter(SessionNeverEstablishedLogFilter.java:61)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at com.force.http.routing.RoutingFilter.doFilter(RoutingFilter.java:72)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at com.force.http.routing.RoutingFilter.handleFilter(RoutingFilter.java:121)
    at com.force.http.routing.RoutingFilter.doFilter(RoutingFilter.java:78)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.Immediate404Filter.doFilter(Immediate404Filter.java:95)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.security.CommonResponseHeaderFilter.doFilter(CommonResponseHeaderFilter.java:70)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.buffer.CommonResponseBufferSizeAdjusterFilter.doFilter(CommonResponseBufferSizeAdjusterFilter.java:37)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at klein9.filter.IncludableResponseWrapperFilter.doFilter(IncludableResponseWrapperFilter.java:38)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.logging.CommonAccessLogFilter.doFilter(CommonAccessLogFilter.java:54)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.context.CommonRequestIdFilter.doFilter(CommonRequestIdFilter.java:72)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.RegulatorWaitTestFilter.doFilter(RegulatorWaitTestFilter.java:61)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.RegulatorFilter.doFilter(RegulatorFilter.java:86)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at system.filter.RequestPathSecurityFilter.doFilter(RequestPathSecurityFilter.java:70)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.encoding.CommonRequestEncodingFilter.doFilter(CommonRequestEncodingFilter.java:86)
    at system.filter.RequestEncodingFilter.doFilter(RequestEncodingFilter.java:56)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at org.eclipse.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:582)
    at org.eclipse.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty9.server.handler.gzip.GzipHandler.handle(GzipHandler.java:493)
    at klein9.handler.SfdcGzipHandler.handle(SfdcGzipHandler.java:52)
    at org.eclipse.jetty9.security.SecurityHandler.handle(SecurityHandler.java:524)
    at org.eclipse.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)
    at klein9.jetty9.RegexServletHandler.doScope(RegexServletHandler.java:220)
    at org.eclipse.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1092)
    at org.eclipse.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty9.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty9.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:318)
    at org.eclipse.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at klein9.handler.SfdcJettytHandler.handle(SfdcJettytHandler.java:72)
    at org.eclipse.jetty9.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)
    at org.eclipse.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty9.server.Server.handle(Server.java:518)
    at org.eclipse.jetty9.server.HttpChannel.handle(HttpChannel.java:308)
    at org.eclipse.jetty9.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty9.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty9.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty9.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
    at org.eclipse.jetty9.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
    at org.eclipse.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
    at org.eclipse.jetty9.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
    at java.lang.Thread.run(Thread.java:745)

I tried to add attribute name to the subcomponent but it doesn't work. Note that this exception is thrown only the first time that I click on the button, from the second on it adds the row as expected. Have you any idea to solve this problem? Thanks in advance.

  • You tried $A.createComponent("c:OrganizeEnvelopeRow", {name: "xyz"},? And no name attribute in the sub-component? – Keith C Apr 19 '17 at 8:59
  • I tried this: $A.createComponent("c:OrganizeEnvelopeRow", {"name": "xyz"}, with name surrounded by curly brackets. – DarkSkull Apr 19 '17 at 9:00
  • Can you post more of the code of the subcomponent ? Are you using any Lightning Base Component in it ? – Fabien Taillon Apr 19 '17 at 9:04
  • I updated my question – DarkSkull Apr 19 '17 at 9:08
2

Error at <lightning:input aura:id="nomeDoc" label=" " />

A lightning:input component has required attributeName as name you must include it .

<lightning:input aura:id="nomeDoc" label=" " name="test"/>
| improve this answer | |
  • vignesh, I don't change anything in the above code. And it throws this exception: aura://ComponentController: org.auraframework.throwable.AuraExecutionException: org.auraframework.impl.root.component.IfProvider: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean. Only the first time as before. – DarkSkull Apr 20 '17 at 8:04
  • 1
    Look a ` <lightning:button>` tabindex as {!Index} you are not referring it. try removing that – vignesh Apr 20 '17 at 8:08

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.