Combine name field and category :label on save

By Dave - October 27, 2017

Hi Zicky, 

The first thing you want to do is add some debug code to see what variables you have to work with.  Try: 


If new_category is a number you'll have to load the label manually.  Check out the function getListOptionsFromSchema().  You can pass it a fieldSchema to get the values for that field, eg: (untested code)

$fieldSchema    = $GLOBALS['schema']['news_category'];
$valuesToLabels = getListOptionsFromSchema(fieldSchema);
$fieldLabel     = @$valuesToLabels[ @$_REQUEST['news_category'] ];

But you'll want to use showme() on the different variables if it doesn't work at first try to see what data you're getting.

Hope that helps!

Dave Edis - Senior Developer