0

My Parent Component

    <lightning:button onclick="{!c.editProductGenerationGrid}" disabled="{!v.disablebutton}" variant="brand" aura:id="Edit1" label="Edit" />  
<lightning:button onclick="{!c.updateNotifications}" disabled="{!v.disablebutton}" variant="brand" aura:id="Update1" label="Update" />
     <c:HBCProductDevelopment aura:id="porductDevelopmentDetails" porductDevelopmentDetails="{!v.Product_Generation_Grid}" />

Helper

updateNotifications : function(component,resolve, reject){
         var action = component.get("c.sendUpdateNotification");
         var inputVal = component.find('inputCmp');
         var value = inputVal.get("v.value");
        alert(value);
        action.setParams({
                "hbcProductGenerationGrid": component.get("v.Product_Generation_Grid"),
            "sectionName" :component.get("v.currentSectionName")
            });
        action.setCallback(this, function(response) {
                    if (response.getState() === "SUCCESS") {
                        alert('Record Updated');
                    }
                else{
                }
            });
        $A.enqueueAction(action);
    },

My Child Component

<lightning:layoutitem flexibility="auto" padding="around-small" size="6">
            <lightning:input name="System Plan Name"
                label="System Plan Name" disabled="{!v.disableSection}"
                             type="text"  maxlength="100" aura:id="inputCmp" value="{!v.porductDevelopmentDetails.HBC_System_Plan_Name__c}"/>
        </lightning:layoutitem>

Now my requirement is I need to check whether System Plan Name is null or not. To check this I need to get the aura:id value in my Parent. How can I get the value their?

closed as off-topic by Oleksandr Berehovskyi, Raul, Basti, battery.cord, glls Feb 21 '18 at 14:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Oleksandr Berehovskyi, Raul, Basti, battery.cord, glls
If this question can be reworded to fit the rules in the help center, please edit the question.

0

You're assigning the value of the Product_Generation_Grid attribute from your parent to your porductDevelopmentDetails attribute in your child.

Then, the Lightning system binds the two values.

So, in your parent, you only have to check this: $A.util.isEmpty(component.get("v.Product_Generation_Grid").HBC_System_Plan_Name__c)) == false

  • Thats Perfect.But when I try to display the error message var inputVal = component.get("v.Product_Generation_Grid").HBC_System_Plan_Name__c; if(isNaN(inputVal)) component.set("v.errors", [{message:"Input not a number:"}]); it is not getting displayed. Can you please update the answer – Eagerin Sf Feb 21 '18 at 9:52
  • Is there any reason why you set your lightning:input as type text instead of directly set it to number? – Martin Lezer Feb 21 '18 at 10:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.