execute javascript when another field in table row has changed

Hello,

I am struggling to figure out how to make the if statements run each time the Status__c field is changed, is anyone able to help me with this? I’m sure it is something simple.

The snippet is on the Comments__c field in a table:


var $ = skuid.$;
var field = arguments[0],
    value = arguments[1],
    model = field.model,
    row = field.row;

if ( row.Status__c===“Not Applicable” ) {
    skuid.ui.fieldRenderers.TEXT.edit(field, value);
        if( value === null ){
            field.element.css({‘border’:‘solid 2px #ff0000’});
        }
}
else if ( row.Status__c===“Completed” ) {
    skuid.ui.fieldRenderers.TEXT.readonly(field,value);
}
else {
    skuid.ui.fieldRenderers.TEXT.readonly(field,value);
}

You could add a model action on “row updated, field value changed” to re-query the model that it re-renders the table.

great! that works like a charm!

When Row in Model updated (Status__c) -> Adopt rows into Model from Model

Now I am looking to make the Comments__c field required when the Status is set to Not Applicable

edit: nevermind! a simple validation rule was perfect for this instance