I am trying to make fields conditionally required on rows in a table based on the value of another field on that specific row using a custom renderer snippet and addRequiredField/removeRequiredField.
It actually works for rows that are consistent with the last row put into edit mode. However, the condition is not enforced for rows that don’t share the condition of that last row.
If I look at the snippet, I guess the results kind of make sense but I thought it would work differently based on the documentation for skuid.ui.
I’m guess this is an easy one and likely discussed a number of times. If you have any recommendations, please share.
Here’s a little more detail before I share the code. I have a table that contains Opportunity data. It has sale rows and churn rows. If the row is a sale, I want 2 fields required. If it is churn, I don’t want them required. When I put a sale row in edit mode, the fields become required. If I then open a churn row, the fields are no longer required (not even on the sale row). Here’s the snippet:
var $ = skuid.$;
var field = arguments[0],
value = arguments[1],
list = field.item.list,
row = field.row;
// Run the default renderer
skuid.ui.fieldRenderers[field.metadata.displaytype]field.mode;
switch( field.mode )
{
case ‘edit’:
if (row.OpptyType === ‘Wireless Sale’ || row.OpptType === ‘Wireline Sale’) {
list.addRequiredField({ id: ‘Third_Party_Consultant__c’ });
list.addRequiredField({ id: ‘Incumbent_Provider__c’ });
} else {
list.removeRequiredField({ id: ‘Third_Party_Consultant__c’ });
list.removeRequiredField({ id: ‘Incumbent_Provider__c’ });
}
break;
case ‘read’:
break;
case ‘readonly’:
break;
}
Question
Problem with making fields conditionally required on rows in a table based on the value of another f
This topic has been closed for replies.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
