I am trying to make a form where the user can update information that will be logged in a separate SQL query. To avoid nulls or additional conditional statements in my SQL query, I am trying to set the default value of a number input (borrower_committed_capital) to the above selected company (select3). If the user is trying to add a company (select2), I want the default to be 0. The problem I am having is trying to match the text identifier to the array pulled by a query listing all borrowers and amount desired numbers.
Below is what I have so far:
{{
var selectVal = select3.value;
var indexedVal = list_active_borrowers.data.borrower_id.indexOf(selectVal);
if (select2.value == 'edit') {
borrower_committed_capital.value = list_active_borrowers.data.borrower_committed[indexedVal]
;}
else {
0.00
}
}}
i'm not quite sure how you mean. I did try and use ternary to select the value, but I am not sure how to do that without passing the index to get as a variable.
I think because you cannot put that in the field itself...
What you could do is for the select2 field where a user selects "edit", you can run an event handler on that field instead using....
One note - a little difficult for me to give more specific thoughts as I am not building your app and am only seeing parts of it....so I can't promise my ideas will work!