Clean the HTML to export data
Clean HTML tags and entities to export your data
- Override the display() of the field to strip the tags… but this would affect all parts of the application where the HTML fields are displayed.
- Create a grafted field, then override its display to show the stripped contents of the HTML area field.
e.g. in the fields.ini:
__sql__ = "select t.*, null as stripped_field from mytable t"
[original_field]
widget:type=htmlarea
visibility:csv=hidden
[stripped_field]
visibility:csv = visible
visibility:list=hidden
visibility:browse=hidden
visibility:find=hidden
Then in the delegate class:
function stripped_field__display($record){
return html_entity_decode(strip_tags($record->val('original_field')), ENT_QUOTES, 'UTF-8');
}
var disqus_identifier = ‘xataface.com/wiki/Clean_the_html_for_the_export’; (function() { var dsq = document.createElement(‘script’); dsq.type = ‘text/javascript’; dsq.async = true; dsq.src = ‘http://xataface.disqus.com/embed.js’; (document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0]).appendChild(dsq); })(); blog comments powered by Disqus
//<![CDATA[ (function() { var links = document.getElementsByTagName(‘a’); var query = ‘?’; for(var i = 0; i < links.length; i++) { if(links[i].href.indexOf(‘#disqus_thread’) >= 0) { query += ‘url’ + i + ‘=’ + encodeURIComponent(links[i].href) + ‘&’; } } document.write(‘