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
Prakhyat sapraPrakhyat sapra 

I have to make a lwc component take 4 inputs from the screen for the obiect Lead. then on the click of save button it will direct to new component in this component. I need to fetch all the details which I saved in the previous screen.  please help

I have to make a lwc component take 4 inputs from the screen for the obiect Lead. then on the click of save button it will direct to new component in this component. I need to fetch all the details which I saved in the previous screen. 
 
mukesh guptamukesh gupta

Hi Prakhyat,

For you solution you need to use parent to child communication in LWC


on Parent side you need to fetch all input details like 

 

<!-- lighntingInputExample.html -->
<template>
    <form>
        <div
            class="slds-p-top_small slds-p-bottom_medium slds-align_absolute-center slds-theme_default slds-text-heading_medium">
            <b>Lightning-Input Example</b></div>
        <div class="slds-box slds-theme_default">
            <lightning-input 
                    type="email" 
                    label="Email Address"
                    value={emailvalue}
                    onchange={handleEmailChange}>
            </lightning-input>
            <lightning-input 
                    type="tel" 
                    name="mobile"
                    label="Mobile"
                    value={mobilevalue}
                    onchange={handleMobileChange}>
            </lightning-input>
            <div class="slds-m-top_small slds-align_absolute-center">
                <lightning-button 
                    variant="Neutral" 
                    label="Cancel" 
                    class="slds-m-left_x-small" 
                    onclick={handleCancel}>
                </lightning-button>
                <lightning-button 
                    variant="brand" 
                    class="slds-m-left_x-small" 
                    label="Next" 
                    onclick={handleNext}>
                </lightning-button>
            </div>
        </div>

<c-child-comp childGetingEmail = {sendToChildEmail} childGetingMobile = {sendToChildMobile}>
    </form>
</template>
 


 

import { LightningElement } from 'lwc';

export default class InputExample extends LightningElement() {

    emailvalue ="username@example.com";
    mobilevalue= "000-000-0000";

    sendToChildEmail;
    sendToChildMobile;

    handleEmailChange(event){
        this.emailvalue = event.target.value;
    } 

    handleMobileChange(event){
        this.mobilevalue = event.target.value;
    } 

    handleNext() {

        alert('email '+ this.emailvalue);
        alert('Mobile '+ this.mobilevalue);
        
    }
}
 

You need to declerae in child component 
@api childGetingEmail
@api childGetingMobile




if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh