Not able to display required message properly when tried using custom javascript for dynamic table f

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 [undefined]”

var $ = skuid.$, model = arguments[0].model,
list = arguments[0].item.list ,
element = arguments[0].element;

console.log('arguments[0] '+arguments);
var valueType = model.getFieldValue( row , ‘Data_Type__c’ );

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

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.fieldRenderers[field.metadata.displaytype][field.mode]( field, value );  
        console.log( fieldName + ' rendered!', field.element );  
        skuid.ui.fieldRenderers[field.metadata.displaytype].edit( field, value );  

return field.element;

switch ( valueType ){
case ‘Extended Amount’:
$(’’).text(’ Qty: '),

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

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

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

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



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.