Using lightning-input in Lightning Record edit form lwc

1.1k Views Asked by At

With record-edit form i'm using Lightning-input instead of lightning-input-field(for validation and other purpose)

<lightning-record-edit-form record-id={recordId} object-api-name={objectName}  >
   <template for:each={**variable**} for:item="item">
      <div lwc:if={some condition} key={item.id} >
                            <lightning-input data-type="user-input"  name={item.name}  value={item.value} >
                            </lightning-input>
                            
                    </div>
   </template>
<save  &  Cancel buttons with onClick> 
</lightning-record-edit-form>
  1. Not able to save the field values. Did try updating track variable-> variable in the javascript and also saw the changes via console.log but does not save it back the object. Any suggestion to make it work like " lightning-input-field"

2)In lwc:if i want to check if item.value=='apple'||item.value=='banana' something along those lines. I know using Js function would solve but is there any solution in html itself PS: any suggestion using recordId and object'sName

0

There are 0 best solutions below