I am storing values in wrapper from UI input: Component is like (on press of submit button, calling Controller)

<aura:component controller="AccountCreationFormClass" implements="force:appHostable>
<aura:attribute name="AccountWrapper" type="CommonWrapperClass.AccountCreationWrapperClass"/>
<ui:inputText value="{!v.AccountWrapper.Name}" />
<ui:button label="Submit" press="{!c.Submit}"/>

Wrapper class is like

public class CommonWrapperClass{
    public class AccountCreationWrapperClass{
@AuraEnabled public String Name {get;set;}
public AccountCreationWrapperClass(){
            Name = '';

Component is like (showing only submit part)

Submit : function(component, event, helper){
        var objAccount = component.get("v.AccountWrapper");
        console.log("Individual Values: " + objAccount.Name);  // Values are shown    
        console.log("Value of ObjAccount1: " + JSON.stringify(component.get("v.AccountWrapper"))); // Values not shown
        console.log("Value of ObjAccount2: " + JSON.stringify(objAccount)); // Values not shown
        console.log("Value of ObjAccount3: " + objAccount);   // Values not shown

When I am trying to see values from individual component of the wrapper (where ever: // Values are shown comment), its showing user entered values but values are not showing up from wrapper (where ever: // Values not shown comment)

Here is my doInit where I am assigning default values

doInit : function(component, event, helper){        
        var tempArray = [];


Attribute "AccountWrapper" is not of type list. And you are assigning Array to this variable. Try using this.

var a = new Object(); 
a.name = 'Test'; 
// All the fields ; 
| improve this answer | |

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.