In LWC development, I have a form and onsubmit I call the handler handleSubmit()
<lightning-record-edit-form
record-id={recordId}
object-api-name={objectApiName}
onsubmit={handleSubmit}>
In the JS controller, i have the following function:
handleSubmit(event){
event.preventDefault();
const fields = event.detail.fields;
//do things
}
- In Javascript, objects can have any type/number of attributes, is there anywhere we are able to see a conventional/default structure of the
event? Is there a base standard for the event object and its attributes? - I use
event.detail.fieldsbecause I saw this in an example, but it would have taken me a long time to manually find that I should use event.detail.fields. How does one know which attributes to access? - I am learning Javascript, but logging objects to console in chrome is different than java / Salesforce. If I
console.log(event);, I there is a lot of getters / setters / target / handler, etc... and it is hard to click through to find info i want. Any insight on best practices to visualize js objects (even links towards any documentation on this would be extremely helpful me master this concept of JS
