Skip to main content



Please find the javascript which is used to display different fields as required in the same column in the table based on the Data type picklist value field and when we tried to save it is throwing error message but its not displaying the field label .


Error Message: “Required Fields have no Value eundefined]”


var $ = skuid.$, model = argumentse0].model,

list = argumentse0].item.list ,

item=argumentse0].item,

row=argumentse0].row,

element = argumentse0].element;


console.log('argumentse0] '+arguments);

var valueType = model.getFieldValue( row , ‘Data_Type__c’ );

console.log(‘repeating’);


list.addRequiredField({ id: ‘Number_Draft_Value__c’ });


console.log();

function renderField( fieldName,defaultValue ){


var field = new skuid.ui.Field( row, model, null, { fieldId: fieldName, register: true, mode: 'edit' } ),  
value = model.getFieldValue( row , fieldName ) ||defaultValue;
console.log( field, value );

if(field && field.metadata && field.metadata.displaytype ){
//skuid.ui.fieldRenderersifield.metadata.displaytype]afield.mode]( field, value );
console.log( fieldName + ' rendered!', field.element );
skuid.ui.fieldRenderersifield.metadata.displaytype].edit( field, value );
}

field.required=true;

field.render();

return field.element;

}


switch ( valueType ){

case ‘Extended Amount’:

element.append(

$(‘’).text(’ Qty: '),


        renderField( 'Quantity\_Draft\_\_c' ,''),  
$('').text(' Unit: '),

renderField( 'Unit\_Draft\_\_c','' ),
$('').text(' Rate: '),

renderField( 'Rate\_Draft\_\_c','' ),
$('').text(' Total: '),

renderField( 'Total\_DRAFT\_\_c' ,'') );
break;
case 'Date':
element.append( //$('').text(' Date Value '),
renderField( 'Date\_Draft\_Value\_\_c' ,''));

break;

}

Hi, Soundar. I think you need to send some additional metadata into the list.addRequiredField function. You can use skuid.model.Model.getField to get the full Salesforce field metadata as a JavaScript object. Assuming that the Number_Draft_Value__c field is in the model being passed to that snippet, try something like this:


var fieldMetadata = model.getField('Number_Draft_Value__c'); list.addRequiredField(fieldMetadata);



Nothing jumps out at me here as obviously wrong.  You are using all the standard API methods that I would expect to do the field rendering as appropriate.  I believe where things are going south is on your model save action (which is more of a core skuid thing). 

I’d encourage you to more thoroughly investigate the model after you have made changes to see if all the fields have names,  to see what the requiredness value is set to,  to see whether the changes node is populated with what you would expect etc. 

We can’t exactly reproduce your issue here because of all the customization in your code and metadata,  but you should be able to debug this. 


Reply