Skip to content

Instantly share code, notes, and snippets.

@srujan21
Created January 29, 2020 08:49
Show Gist options
  • Save srujan21/b7d3bc16cc57ee1ba88037f9b76386bb to your computer and use it in GitHub Desktop.
Save srujan21/b7d3bc16cc57ee1ba88037f9b76386bb to your computer and use it in GitHub Desktop.
A sample lightning form along with Quick Action
<aura:component implements="force:lightningQuickAction,force:hasRecordId" controller="SourceSendEmailController">
<aura:attribute name="subject" type="String" />
<aura:attribute name="emailId" type="String" />
<aura:attribute name="body" type="String" />
<lightning:input aura:id="emailform" name="input2" label="Email Id" value = "{!v.emailId }" required="true"/>
<lightning:input aura:id="emailform" name="input1" label="Subject" value = "{!v.subject }" required="true"/>
<lightning:textarea aura:id="emailform" name="input3" label="Body" value = "{!v.body }" required="true"/>
<br/>
<div class="slds-align_absolute-center">
<lightning:button variant="brand" label="Send Email" title="Send Email" onclick="{! c.validate }" />
</div>
</aura:component>
validate: function(component, event, helper) {
var isValid = component.find('emailform').reduce(function (validSoFar, inputCmp) {
// Displays error messages for invalid fields
inputCmp.showHelpMessageIfInvalid();
return validSoFar && inputCmp.get('v.validity').valid;
}, true);
// If we pass error checking, do some real work
console.log('isValid********' + isValid);
if(isValid){
helper.sendEmailJS(component, event, helper);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment