function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shruthi GM 6Shruthi GM 6 

Be code is not taking any input values in Lightning.What should be done?

Please help.Here is my code.
It creates form to be filled by a user.
When I trying to type inside the form,nothing is happening.
Please help.


Code:-

<aura:component>
    <lightning:layout class="slds-page-header slds-page-header--object-home">
        <lightning:layoutItem padding="horizontal-large">
            <div class="page-section page-header">
               
                <h1 class="slds-text-heading--large">School Application Form</h1>
               
            </div>   
            <div>
                <h2 class="slds-text-heading--medium">Form Details</h2>
            </div>
        </lightning:layoutItem>
    </lightning:layout> 
    
    
    <lightning:layout>
        <lightning:layoutItem padding="around-large" size="10">
            <!-- CREATE NEW EXPENSE -->
    <div aria-labelledby="newschoolApplicationform">
    
    <lightning:layout>
        <lightning:layoutItem padding="around-small" size="6">
            <!-- CREATE NEW School application form -->
    <div aria-labelledby="newschoolform">
         </div>
        </lightning:layoutItem>
    </lightning:layout>
    
     <fieldset class="slds-box slds-theme--default slds-container--small">
        <legend id="newschoolform" class="slds-text-heading--small 
          slds-p-vertical--medium">
          Add Details
        </legend>
    
     <!-- CREATE NEW SCHOOL APPLICATION FORM -->
        <form class="slds-form--stacked">          
            <lightning:input type="text" aura:id="schoolform" label="School Name"
                             name="Name"
                             value="{!v.newSchool.Name}"
                             required="true"/> 
            <lightning:input type="Phone" aura:id="schoolform" label="Mobile Ph No" 
                             name="Mobile Number"
                             value="{!v.newSchool.Mobile_Number__c}"
                             required="true"
                             messageWhenRangeUnderflow="Enter mobile number with 10 digits"/>
            <lightning:input aura:id="schoolform" label="Contact Address"
                             name="Address"
                             required="true"
                             value="{!v.newSchool.Contact_Address__c}"
                             />
            <lightning:input type="checkbox" aura:id="schoolform" label="Wanna Enjoy Schooling?"  
                             name="Wanna join the school"
                             required="true"
                             checked="{!v.newSchool.Do_you_wanna_join_the_mentioned_school__c}"/>
            <lightning:button label="Submit" 
                              class="slds-m-top--medium"
                              variant="brand"
                              onclick="{!c.clickCreate}"/>
        </form>
        <!-- / CREATE NEW EXPENSE FORM -->
  
      </fieldset>
      <!-- / BOXED AREA -->
        
            </div>
    
            </lightning:layoutItem>
    </lightning:layout>
    <!-- / NEW EXPENSE FORM -->
    
</aura:component>
Khan AnasKhan Anas (Salesforce Developers) 
Hi Shruthi,

Greetings to you.

You need to create the attribute with name newSchool 
Attributes on components are like instance variables in objects. They’re a way to save values that change, and a way to name those value placeholders.

Use this line of code in component:
<aura:attribute name="newSchool" type="Registration_Form__c" default="{'sobjectType' : 'Registration_Form__c'}"/>

Here, Registration_Form__c is sObject name. Replace it with your sObject name.


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas
Raj VakatiRaj Vakati
THis is the correct code
 
<aura:component>

<aura:attribute name="newSchool" type="Registration_Form__c" default="{'sobjectType' : 'Registration_Form__c'}"/>


    <lightning:layout class="slds-page-header slds-page-header--object-home">
        <lightning:layoutItem padding="horizontal-large">
            <div class="page-section page-header">
               
                <h1 class="slds-text-heading--large">School Application Form</h1>
               
            </div>   
            <div>
                <h2 class="slds-text-heading--medium">Form Details</h2>
            </div>
        </lightning:layoutItem>
    </lightning:layout> 
    
    
    <lightning:layout>
        <lightning:layoutItem padding="around-large" size="10">
            <!-- CREATE NEW EXPENSE -->
    <div aria-labelledby="newschoolApplicationform">
    
    <lightning:layout>
        <lightning:layoutItem padding="around-small" size="6">
            <!-- CREATE NEW School application form -->
    <div aria-labelledby="newschoolform">
         </div>
        </lightning:layoutItem>
    </lightning:layout>
    
     <fieldset class="slds-box slds-theme--default slds-container--small">
        <legend id="newschoolform" class="slds-text-heading--small 
          slds-p-vertical--medium">
          Add Details
        </legend>
    
     <!-- CREATE NEW SCHOOL APPLICATION FORM -->
        <form class="slds-form--stacked">          
            <lightning:input type="text" aura:id="schoolform" label="School Name"
                             name="Name"
                             value="{!v.newSchool.Name}"
                             required="true"/> 
            <lightning:input type="Phone" aura:id="schoolform" label="Mobile Ph No" 
                             name="Mobile Number"
                             value="{!v.newSchool.Mobile_Number__c}"
                             required="true"
                             messageWhenRangeUnderflow="Enter mobile number with 10 digits"/>
            <lightning:input aura:id="schoolform" label="Contact Address"
                             name="Address"
                             required="true"
                             value="{!v.newSchool.Contact_Address__c}"
                             />
            <lightning:input type="checkbox" aura:id="schoolform" label="Wanna Enjoy Schooling?"  
                             name="Wanna join the school"
                             required="true"
                             checked="{!v.newSchool.Do_you_wanna_join_the_mentioned_school__c}"/>
            <lightning:button label="Submit" 
                              class="slds-m-top--medium"
                              variant="brand"
                              onclick="{!c.clickCreate}"/>
        </form>
        <!-- / CREATE NEW EXPENSE FORM -->
  
      </fieldset>
      <!-- / BOXED AREA -->
        
            </div>
    
            </lightning:layoutItem>
    </lightning:layout>
    <!-- / NEW EXPENSE FORM -->
    
</aura:component>