AnsweredAssumed Answered

How to format a custom field data before save, and before showing?

Question asked by amityweb on Jul 24, 2014
Latest reply on Jul 28, 2014 by amityweb
Does anyone know how to format data before saving it in a custom field? And to format the data before displaying it too? 

I want to save a JSON array of multiple fields I am adding to the views. So I want to combine all the data into JSON format, then save it, and then to display it in DetailView I want to first extract the JSON data. 

But I cant see how to do it, I have experimented with functions found from other fields like formatField(), unformatField(), save(), but I cant get them to work. 

I can get my custom EditView.tpl and DetailView.tpl to work fine. Just cant seem to intercept the data before and after these views. 

I suppose I could format the data in the getDetailViewSmarty and getDetailViewSmarty before showing on the page... but cant see how to format the data before saving. 

Thanks a lot

Outcomes