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
Niki Shah 12Niki Shah 12 

how to display data in input text form from object in lightning component

controller

({
    doInit : function(component, event, helper) {
        
       var action = component.get("c.getProjectDetails");
      //action.setparm
        action.setCallback(this,function(response){
             if (response.getState() === "SUCCESS"){
                    component.set("{!v.contacts}",response.getReturnValue());
                }
            
       
            var dodge__DR_NBR__c = response.getState();
            if (dodge__DR_NBR__c === "SUCCESS") {
               
                 component.set("v.contacts", response.getReturnValue());
                    
               
                console.log(response.getReturnValue());
            }
            
            }
        );
        
    
    
        
        var action1 = component.get("c.getProjectList");
        action1.setCallback(this,function(response){
                if (response.getState() === "SUCCESS"){
                    component.set("{!v.details}",response.getReturnValue());
                }
     
            var dodge__DR_NBR__c = response.getState();
            if (dodge__DR_NBR__c === "SUCCESS") {
                component.set("v.details", response.getReturnValue());
                console.log(response.getReturnValue());
            }
            
            }
        );
 
         $A.enqueueAction(action);
         $A.enqueueAction(action1);
        
       
         

 
    }
})

component

<aura:component controller="LeadRep" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global"  >
  <aura:attribute name="contacts" type="String" />
    <aura:attribute name="details" type="String" default="hello"/>
    
    


    
 

 
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
   <!-- Use a data table from the Lightning Design System: https://www.lightningdesignsystem.com/components/data-tables/ -->
       
       
         
   
 <article class="slds-card">
  <div class="slds-card__header slds-grid">
      
      
    <header class="slds-media slds-media_center slds-has-flexi-truncate">
      <div class="slds-media__figure">
        <span class="slds-icon_container slds-icon-standard-account" title="Rep_Lead">
          <lightning:icon iconName="doctype:image" alternativeText="Doc image" />
          <span class="slds-assistive-text">Rep Lead</span>
        </span>
      </div>
      <div class="slds-media__body">
        <h2 class="slds-card__header-title">
          <a href="javascript:void(0);" class="slds-card__header-link slds-truncate" title="Rep_Lead">
            <span>Rep Lead</span>
          </a>
        </h2>
      </div>
    </header>
      
  
  </div>
  <div class="slds-card__body slds-card__body_inner">Card Body</div>
  </article>  
         
         
 <div class="slds-box slds-theme_default">        
     
 <h2>Contact Information</h2>
     
      
     <div class="slds-grid slds-gutters">
  <div class="slds-col">
      
 
 <span><ui:inputText label="Dodge Report Number"  value="{!v.contacts.dodge__DR_NBR__c}" /></span>
   
        <span><span><ui:inputText label="Project name" value="{!v.contacts.dodge__TITLE__c}"/></span></span>
<span><span><ui:inputText label="Project name" value="{!detail.dodge__PROJECT_ROLE__c}"/></span></span>
        </div>
  
</div>   

     
</div>
     
    <table class="slds-table slds-table_cell-buffer slds-table_bordered">
  <thead>
    <tr class="slds-line-height_reset">
        
        
              <th class="" scope="col">
        <div class="slds-truncate" title="dodge__TITLE__c">dodge TITLE</div>
      </th>
      <th class="" scope="col">
        <div class="slds-truncate" title="dodge__PROJECT_ROLE__c">Project Role</div>
      </th>
      <th class="" scope="col">
        <div class="slds-truncate" title="dodge__DR_NBR__c">Dodge Report Number</div>
      </th>
      <th class="" scope="col">
        <div class="slds-truncate" title="dodge__P_ADDR_LINE1__c">Address1</div>
      </th>
      <th class="" scope="col">
        <div class="slds-truncate" title="Project Opportunity">Project Opportunity</div>
      </th>
     
    </tr>
  </thead>
  <tbody>
      <aura:iteration items="{!v.details}" var="detail"> 
       <aura:iteration items="{!v.contacts}" var="contact">    
      
apex class
public class LeadRep {

    
    
@AuraEnabled
   
    Public static list<dodge__DODGE_PROJECT__c>getProjectDetails(){
        return [SELECT dodge__TITLE__c,dodge__DR_NBR__c,dodge__P_ADDR_LINE1__c FROM dodge__DODGE_PROJECT__c where dodge__DR_NBR__c='201800529072'];
    }

   /* @AuraEnabled 
  Public static list<dodge__DODGE_ROLE__c>getProjectList() {
      return [SELECT dodge__PROJECT_ROLE__c FROM dodge__DODGE_ROLE__c where dodge__DR_NBR__c='201800529072'];
  }*/
    @AuraEnabled 
   Public static list<dodge__DODGE_ROLE__c>getProjectList() {
      return [SELECT dodge__PROJECT_ROLE__c,dodge__DODGE_ACCOUNT__c,dodge__DODGE_CONTACT__r.dodge__FIRM_NAME__c FROM dodge__DODGE_ROLE__c where dodge__DR_NBR__c='201800529072']; 
   }
 /* @AuraEnabled 
  Public static list<dodge__Dodge_Project_Lead__c>getDodgeProjectLeadList() {
     return [SELECT dodge__P_ADDR_LINE1__c FROM dodge__Dodge_Project_Lead__c where dodge__DR_NBR__c='201800529072']; 
  }*/
    

    
}
      
    <tr class="slds-hint-parent">
     
      <td>
        <div class="slds-truncate" title="{!contact.dodge__TITLE__c}">{!contact.dodge__TITLE__c}</div>
      </td>
      <td>
        <div class="slds-truncate" title="{!detail.dodge__PROJECT_ROLE__c}">{!detail.dodge__PROJECT_ROLE__c}</div>
      </td>
      <td>
        <div class="slds-truncate" title="{!contact.dodge__DR_NBR__c}">{!contact.dodge__DR_NBR__c}</div>
      </td>
      <td>
        <div class="slds-truncate" title="{!contact.dodge__P_ADDR_LINE1__c}">{!contact.dodge__P_ADDR_LINE1__c}</div>
      </td>
      <td>
        <div class="slds-truncate"  title="Create"><a href="swifterfans--lf1.lightning.force.com/lightning/o/Opportunity/list?filterName=Recent">Create</a></div>
      </td>
      
    </tr>
           
    </aura:iteration>
     
    </aura:iteration>
   
  </tbody>
</table>
    
    
  
</aura:component>        
         
      
Deepali KulshresthaDeepali Kulshrestha
Hi Niki,
I have been doing the same thing. Please refer to the following code snippet as it may be helpful in solving your query,

<form class="slds-form--inline">
    <div class="slds-form-element">
        <lightning:input aura:id="startDate" type="date" label="Start" name="startDate" value="{!v.rangeStart}"/>
    </div>
    <div class="slds-form-element">
        <lightning:input aura:id="endDate" type="date" label="End" name="endDate" value="{!v.rangeEnd}"/>
    </div>
</form>

Then you have to make an appropriate apex class in order to bring values to the form.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha