I am trying to add a custom form field to TemplateOne in OpenCms version <a href="http://6.2.2.">6.2.2.</a> I have not found any documentation anywhere as to how to do this; I am working off of the existing instructions and documentation of the person who developed the custom form field code. I have three files: <br>
<br>CmsTextLabelField.class - A compiled class file of the java source for the new form field, which extends A_CmsField. <br><br>inputfield.xsd - A modified version of the existing file which adds the form field to the FieldType SelectorWidget configuration value. <br>
<br>custom_form_fields.properties - A single line of text which maps the new form field's label (used in inputfield.xsd) to the full class name. It consists of this line:<br>FIELDS=textLabel:org.opencms.frontend.templateone.form.CmsTextLabelField <br>
<br>The instructions I have say the following:<br><br>inputfield.xsd goes into: <br>/system/modules/org.opencms.frontend.templateone.form/schemas/ <br><br>CmsTextLabelField.class goes into: <br>/system/modules/org.opencms.frontend.templateone.form/classes/org/opencms/frontend/templateone/form/ <br>
<br>custom_form_fields.properties goes into: <br>/system/modules/org.opencms.frontend.templateone.form/classes/ <br><br>When I put these files in these directories (within the workspace), I successfully see a new field in the select box when editing a form. It does not have the proper label, however; it shows as:<br>
??? form.field.type.textLabel ???<br><br>When I save the form and try to view it, I get a null pointer exception:<br><br>10 Apr 2008 14:10:08,156 ERROR [mplateone.form.CmsFieldFactory: 199] Unable to create form field class instance for type textLabel!<br>
java.lang.NullPointerException<br> at java.lang.Class.forName0(Native Method)<br> at java.lang.Class.forName(Class.java:164)<br> at org.opencms.frontend.templateone.form.CmsFieldFactory.getField(CmsFieldFactory.java:195)<br>
at org.opencms.frontend.templateone.form.CmsForm.initInputFields(CmsForm.java:1260)<br> at org.opencms.frontend.templateone.form.CmsForm.init(CmsForm.java:627)<br> at org.opencms.frontend.templateone.form.CmsForm.<init>(CmsForm.java:261)<br>
at org.opencms.frontend.templateone.form.CmsFormHandler.init(CmsFormHandler.java:294)<br> at org.opencms.frontend.templateone.form.CmsFormHandler.<init>(CmsFormHandler.java:124)<br> at org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.org_opencms_frontend_templateone_form.pages.form_html_jsp._jspService(form_html_jsp.java:57)<br>
...<br><br>Looking through the source of both CmsForm and CmsFieldFactory for the version 6.2.2 of OpenCms, it appears that it is trying to instantiate the field by calling Class.forName() on the string "textLabel" rather than the full name of the class file (as specified in custom_form_field.properties). How do I fix this? How do I make OpenCms read in the properties file? And, assuming I get that running, is this the standard way to add new form fields? Is there any documentation on this process available somewhere? I am an experienced Java developer, but I'm a newbie to OpenCms. Any help would be appreciated.<br>
<br>Thank you! <br><br>