Take a look here, inline javascript is pretty bad. https://github.com/crowbar/barclamp-database/pull/30/files#diff-544509a92d12fe80db22e48e13bca2c4R2