• monalisa das 46
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I have a requirement where I have a validate button for Lightning:recordEditForm on click of which it needs to update certain fields. So my code is something like this
<lightning:recordEditForm  aura:id="recordEditForm" 
                                    recordId="{!v.myObject.Id}"
                                    onsuccess="{!c.handleSuccess}" 
                                    objectApiName="Address__c">
        <lightning:inputField fieldName="Address_Line_1_Native__c" aura:id="addrNative" onchange="{!c.fieldValChange}" />     
<lightning:button variant="brand" name="Validate" label="Validate" onclick="{!c.validate}" />                       
    </lightning:recordEditForm>
and within validate() in JS
component.find("addrNative").set("v.value", "Accounting");

This works fine as long user is not entering anything in the field,but when user updates the field and clicks on validate, the button doesn't works
any suggestions?
I have a requirement where I am making use of lightning:recordEditForm to create a new record. I am using standard save functionality. After successful save of record I need to make use of the record Id. Is there is any native way to get Id of record without making server call?
 
<lightning:recordEditForm  onsuccess="{!c.handleSuccess}" onerror="{!c.handleError}"
        aura:id="recordEditForm" 
      objectApiName="Address__c">

            <lightning:messages />

           <lightning:inputField fieldName="Customer__c" value="{!v.accountRecord.Id}" class='slds-hide'/> 

            <aura:iteration items="{!v.displayListAddress}" var="item" >
                <lightning:inputField fieldName="{!item}" onchange="{!c.fieldValChange}"/>                             
            </aura:iteration>  
        <div class="slds-modal__footer">
           <div class="slds-align_absolute-center">
              <lightning:button label="Cancel" title="Neutral action" onclick="{! c.closeEdit }"/>
              <lightning:button variant="brand" type="submit" name="save" label="Save" />
           </div>
        </div>

I thought that after successful record creation the recordId attribute will get populated with appropriate value and will give proper value via this
alert("Id : "+component.find("recordEditForm").get("v.recordId"));

But this returns undefined.
Though I can make a server call with appropriate filters in SOQL to get Id of the record, but seems there should be some easier way around without server call.

Hello, this is my doubt, how to get the current visualforce page id? I try with {!$Currentpage.Id} or $Page.Id but dont exists this variables.

 

Thanks.

  • November 03, 2011
  • Like
  • 0