implement CustomField layout's javascript