There is a weird scenario I'm facing while I try to bind the markup UI tags with lighting aura:attribute as type sObject (fields). I'm trying to bind data to sobject's fields for different lightning:input tags, For one sObject attribute the binding works perfect, but in the same way for another sObject the data is not getting bound. For Ex:
<aura:attribute name="student" type="JN_Student__c" access="global" default="{'sobjectType' : 'JN_Student__c'}" />
<lightning:input aura:id="requiredVal" name="lastName" label="Legal Last Name"value="{!v.student.JN_Last_Name__c}" maxlength="20" required="true"/>
this works perfectly and the data persists as I show/hide this section. WHEREAS for,
<aura:attribute name="insuranceInstance" type="JN_Insurance__c" access="global" default="{'sobjectType' : 'JN_Insurance__c'}" />
<lightning:input aura:id="requiredVal" name="lastName" label="Legal Last Name" value="{!v.insuranceInstance.Name}" maxlength="20" required="true"/>
the 'v.insuranceInstance.Name' doesn't persists its value.
Please reply if anyone knows/encounted the same.