Dynamic form validation, javascript expression

Greetings, I’ve been trying to use the new Javascript logic in forms. I’m having some trouble with knowing what I can and can’t use.

I currently need to iterate over a dynamic datatable and summarize all the values in a column if they are selected. Then display the sum in a field above it.

My question is whether I could get an example of or list mentioning all functionality available in these reduced javascript expressions.

Here’s, the form:

And heres the logic:

result = 0;
for(var x in data.table)
{
result = x;
if(x.selected)
{
result += x.amount;
}
}
return result;

I managed to figure it out, I used an index instead of an iterator for the loop and it worked, but a list of functions or a showcase would be wildly appreciated for this feature, since I can’t find info on it anywhere except for in the announcement for it.

My code now:
result = 0;
for(var i = 0; i < data.table.length; i++)
{
if(data.table[i].selected)
{
result += data.table[i].amount;
}
}
return result;

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.