You need to sign in to do that
Don't have an account?
d.tejdeep@nicomatic.in
I want to make other lead time value compulsory when they select lead time as "other" and I want to show this error, message on each and every step and action not at the end while clicking save button
how to validation base on lightning:select value ?
<lightning:select value="{!v.BatchInstance.LeadTime__c}" aura:Id="leadtimesel" onchange="{!c.validateotherleadtime}"> <option value=""> - </option> <option value="Within 48 hours"> Within 48 hours </option> <option value="1 Week"> 1 Week </option> <option value="2 Weeks"> 2 Weeks </option> <option value="3 Weeks"> 3 Weeks </option> <option value="4 Weeks"> 4 Weeks </option> <option value="5 Weeks"> 5 Weeks </option> <option value="6 Weeks"> 6 Weeks </option> <option value="7 Weeks"> 7 Weeks </option> <option value="8 Weeks"> 8 Weeks </option> <option value="More than 8 weeks"> More than 8 weeks </option> <!--<option value="1 week if Qty<=999, 4 weeks if Qty>999"> 1 week if Qty<=999, 4 weeks if Qty>999 </option> <option value="1 week if Qty<=249, 2 weeks if Qty>249"> 1 week if Qty<=249, 2 weeks if Qty>249 </option> --> <option value="In stock"> In stock </option> <option value="Other"> Other </option> </lightning:select> </td> <td> <lightning:input value="{!v.BatchInstance.Other_Lead_Time__c}" aura:id="otherleadtime" /> </td>
validateotherleadtime : function(component, event, helper) { var leadesl = component.find("leadtimesel"); var leadeslvalue = leadesl.get("v.value"); var otherleadtime = component.find("otherleadtime"); var otherleadtimevalue = otherleadtime.get("v.value"); if(leadeslvalue==='Other' & !otherleadtimevalue) { otherleadtime.set("v.errors", [{message:"Other lead time is compulsory"}]); }else{ //otherleadtime.set("v.errors", null); } }
I want to make other lead time value compulsory when they select lead time as "other" and I want to show this error, message on each and every step and action not at the end while clicking save button