I need your help for get a dynamic values from a dynamic form. What I mean with "dynamic form"?

Well, I have the next one code for create 1 or N records

    <aura:attribute name="guestAdditional" type="Guest__c[]" default="{ 'sobjectType': 'Guest__c',
                                                                            'nameAdditional': '', 
                                                                            'lastNameAdditional': '', 
                                                                            'emailAdditional': '', 
                                                                            'celAdditional': '' }" />
<aura:iteration var="num" items="{!v.newFields}">
                    <div class="slds-grid slds-gutters">
                        <div class="slds-col">
                            <lightning:input class="guestAdditional" aura:id="{!'guestName_'+num.value}" name="{!'guestName_'+num.value}"  type="text"
                                value="{!v.guestAditional.nameAdditional}" label="Additional name" required="true" placeholder="Additional name"
                                autocomplete="off" />
                        <div class="slds-col">
                            <lightning:input class="guestAdditional" type="text" aura:id="{!'guestLastName_'+num.value}"
                                value="{!v.guestAditional.lastNameAdditional}" name="{!'guestLastName_'+num.value}" label="Last name additional"
                                required="true" placeholder="Last name additional" autocomplete="off" />
                        <div class="slds-col">
                            <lightning:input type="email" aura:id="{!'guestEmail_'+num.value}"
                                value="{!v.guestAditional.emailAdditional}" name="{!'guestEmail_'+num.value}" label="e mail additional"
                                required="true" autocomplete="off" placeholder="e mail additional"
                                class="guestAditional amil-null"/>
                        <div class="slds-col">
                            <lightning:input type="text" aura:id="{!'guestCelPhone_'+num.value}"
                                value="{!v.guestAditional.celAdditional}" name="{!'guestCelPhone_'+num.value}" label="Mobile phone number"
                                required="true" autocomplete="off" placeholder="Mobile phone number" class="guestAditional amil-null" />

                    <br />

Where newFields == 1 or N record or row

And the final result is: enter image description here

I want get each value from this form, but consider that the Id and names could be changed every case since 1 to N fields. But is One row or record.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.