• Sai deep 13
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hello team,
Can you please guide me on "How to use Multiple Multi-Select picklist fields in a lwc".
Requirement:- I have two multi-select picklist fields in a contact object (Languages Spoken, Type). I have to build a form using both the fields in single lwc.

Please help

Thanks and Regards
Sai
Component:-
<lightning:input aura:id="fuploader" type="file" name="file" label="Upload File" multiple="false" required="false"/>

JS Controller:-
({
    doSave : function(component, event, helper) {
        alert('Please wait for few seconds')
       
        if (component.find("fuploader").get("v.files").length > 0 ||component.find("fuploader").get("v.files").length !== NULL) {
                
        helper.uploadHelper(component, event);
            } else{
               alert('Hello');                 
    }
    }
})
Error:- This page has an error. You might just need to refresh it. Action failed: c:InclusionForm$controller$doSave [Cannot read property 'length' of null] Failing descriptor: {c:InclusionForm$controller$doSave



Thank You
public class PatientDemo1_Class {
    public string fileName{get;set;}  
    public Blob fileBody{get;set;}  
Account acc = new Account();
    public Account getacc(){
        acc.Name='PRG';
        return acc;
    }
    public pagereference Saveaccount(){
        insert acc;
        Attachment myAttachment  = new Attachment();  
             myAttachment.Body = fileBody;  
             myAttachment.Name = fileName;  
             myAttachment.ParentId = Acc.Id;  
            insert myAttachment;
        return page.Demo1Thanks;
    }
}

Thanks and regards
Saideep
Component:-
<lightning:input aura:id="fuploader" type="file" name="file" label="Upload File" multiple="false" required="false"/>

JS Controller:-
({
    doSave : function(component, event, helper) {
        alert('Please wait for few seconds')
       
        if (component.find("fuploader").get("v.files").length > 0 ||component.find("fuploader").get("v.files").length !== NULL) {
                
        helper.uploadHelper(component, event);
            } else{
               alert('Hello');                 
    }
    }
})
Error:- This page has an error. You might just need to refresh it. Action failed: c:InclusionForm$controller$doSave [Cannot read property 'length' of null] Failing descriptor: {c:InclusionForm$controller$doSave



Thank You
public class PatientDemo1_Class {
    public string fileName{get;set;}  
    public Blob fileBody{get;set;}  
Account acc = new Account();
    public Account getacc(){
        acc.Name='PRG';
        return acc;
    }
    public pagereference Saveaccount(){
        insert acc;
        Attachment myAttachment  = new Attachment();  
             myAttachment.Body = fileBody;  
             myAttachment.Name = fileName;  
             myAttachment.ParentId = Acc.Id;  
            insert myAttachment;
        return page.Demo1Thanks;
    }
}

Thanks and regards
Saideep