• utkarsh singh 53
  • 0 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
  • 0
I have an input form in a child vf component whose fields are rendered from a field set.  
This child component is being called from a parent component where I want to validate on the parent controller whether the the required fields in child component's field set is filled or not before saving it.
So to do this I will need to access child component's data from a parent vf component's controller. But I am not sure how to access it.
BoatReiews component's doInit is not getting invoked. I have attached the screenshot of the error which I get when the component is called after submiting a review.

User-added image

Below is the code for BoatReview.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global"   controller="BoatReviews">
    <aura:handler name="doInit" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="boat" type="Boat__c"/>
    <aura:attribute name="Id" type="Id" />
    <aura:attribute name="boatReviews" type="BoatReview__c[]" access="private"/>
        <aura:if isTrue="{!v.boatReviews.length==0}">  
            <lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">   
                <ui:outputText value="No Reviews Available" />
        <aura:if isTrue="{!v.boatReviews.length!=0}">
                    <div class="slds-feed">
            <ul class="slds-feed__list">
                <aura:iteration items="{!v.boatReviews}" var="boatReview">
                    <li class="slds-feed__item">
                        <div class="slds-media__body">
                       <div class="slds-grid slds-has-flexi-truncate">
                            <a href="javascript:void(0)" onclick="{!c.onUserInfoClick}"
                        &nbsp; &mdash; &nbsp; {!boatReview.CreatedBy.CompanyName}
                         <p><lightning:formattedDateTime value="{!boatReview.CreatedDate}" 
                                   year="numeric" month="short" day="numeric"  
                                   hour="2-digit" minute="2-digit" hour12="true"/></p>
                    <div class="slds-post__content slds-text-longform">
                        <p> {!boatReview.Name}</p>

    doInit : function(component, event, helper) {
        //alert("BR controller init");
        console.log("BR controller init");
    onUserInfoClick : function(component, event, helper)
    onInit : function(component,event,helper)
         console.log("BR helper init");

        var action =component.get("c.getAll");
        action.setParams(boatId, component.get("v.Id"));
               action.setCallback(this, function(response)
                       var state = response.getState();
                       component.set("v.boatReview", response.getReturnValue());