You need to sign in to do that
Don't have an account?
Chandan Nagar
Want to create a form and bind data from an object.
Hi all,
i am trying to create a lightning component which shows retrieves data from an object and displays that in a field as readonly. Since i am new to salesforce i am stuck in the beginning. I have used accordian to create section but not able to create a form and display values form an object.
Any kind of help is appreciated to jump start this.
The page should look like this with value from a custom object:
i am trying to create a lightning component which shows retrieves data from an object and displays that in a field as readonly. Since i am new to salesforce i am stuck in the beginning. I have used accordian to create section but not able to create a form and display values form an object.
Any kind of help is appreciated to jump start this.
The page should look like this with value from a custom object:
As your requirement ,you can acheive it using lightning-record-form:
1.Viewing a Record with Option to Edit Fields:
Use mode="view" and pass the ID of the record and the corresponding object API name to be displayed. Specify the fields using the fields attribute, or layout-type attribute to display all the fields defined on the Full or Compact layout.
The view mode loads the form using output fields with inline editing enabled. You can edit fields that are marked updateable in the User Interface API. If the user clicks an edit icon next to a field, all fields that are updateable become editable, and the form displays Cancel and Save buttons.
This example creates a form for an account record in view mode with fields from the full layout. Update the record ID with your own.
2.Viewing a Record with Read-Only Fields:
Use mode="readonly" and pass the ID of the record and the corresponding object API name to be displayed. Specify the fields using the fields attribute, or layout-type attribute to display all the fields defined on the Full or Compact layout.
The readonly mode loads the form with output fields only, and without Cancel or Save buttons.
This example creates a form for an account record in readonly mode with a single column and fields from the compact layout. Update the record ID with your own.
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
www.kdeepali.com