0

Hi in func2 i am not getting the value of input text. I'm doing this way because firstly i am pre-populating value, and i can clear the text value so that in SelectedRecordProj should be null.

Cmp

<aura:attribute name="SelectedRecordProj" type="Project__c" />
<ui:inputText label="Project Name" value="{!v.SelectedRecordProj.Name}" aura:id="SelectedProj" required="true" class="width" />

In one function snippet is: func1

js

    NewO: function(component, event, helper) {        
   var projName = component.get("v.projData1");  
   component.set("v.SelectedRecordProj", projName);
    }

In another function snippet is: func2

    NewO1: function(component, event, helper) { 
    var abc=(component.find("SelectedProj").get("v.value"));
    alert('abc'+abc);
    }
2

1 Answer 1

2

I think the problem is in your attribute declaration SelectedRecordProj. I tried it on my org and got an error. Then I tried to give default values to fields of that object in the attribute declaration and it works.

You should try like this:

<aura:attribute name="SelectedRecordProj" type="Project__c" default="{'sobjectType':'Project__c', 'Name':''}" />
<ui:inputText label="Project Name" value="{!v.SelectedRecordProj.Name}" aura:id="SelectedProj" required="true" class="width" />

<ui:button label="Submit" press="{!c.NewO1}" /> <br></br>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .