0

I am writing an app that will help calculate the statute of limitations for certain laws. ex. enter a date that a crime happened on and, after choosing a law and appropriate limitation the limitation time will be added to the date you entered giving the date the limitation is up on.

I have an aura iteration that iterates through some of my statutes for the user to choose. to help the user pick I display a description of the statute in the drop down options, {!stat.Description__c}. then below that I would like to show the user the actual time limit associated with their choice. But I cant find a way to show the user anything different than the label I display in the select options. code below

component:

<!-- Select Statute -->
<ui:inputSelect aura:id="dropStat" label="Select statute if multiple based on description" class="dynamic" change="{!c.onStatChange}">
    <aura:iteration items="{!v.statute}" var="stat">
        <ui:inputSelectOption text="{!stat.Description__c}" label="{!stat.Description__c}" />        
    </aura:iteration>
</ui:inputSelect>

The statute of limitation is:

<ui:outputText value="{!v.statNum.Limit__c}"/>

controller:

onStatChange : function(component, event, helper){
    var selected = component.find("dropStat").get("v.value");
    console.log('selected statute is', selected);
    component.set("v.statNum");
}

note that the data types of v.statute and v.statNum are both SObject Thanks in advance! Any feedback is greatly appreciated

0

did this with a for loop

Js Controller: (yes I know I should have probably put this in the helper)

onStatChange : function(component, event, helper){ var selected = component.find("dropStat").get("v.value"); let statObject = component.get("v.statute"); for(let i=0; i < statObject.length; i++){ if(statObject[i].Description__c == selected){ component.set("v.statNum", statObject[i].Limit__c) } } }

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.