fix broken js code.
fix for each loop.
Merge branch 'master' into topic/fieldbook_ajax