Trying to test adding a custom PasswordField to the hippo-addon-eforms-demo project - Enterprise forms documentation

149 views
Skip to first unread message

weba...@moen.com

unread,
Apr 19, 2016, 10:56:39 AM4/19/16
to Hippo Community
I'm trying to follow the steps provided within the "Enterprise Forms" and "Custom Form Fields" and when viewing the page through the site via the http://localhost:8080/site url, I'm getting the following errors in the tomcat log file.
I downloaded the hippo enteprice demo package and unzipped it. I figured I start my testing of enterprise in this package rather than my companies own (we're just starting implementing the Hippo CMS).
I'm able to see the new field as a choice and add it to a form, just not able to view it on the website side.


INFO] [talledLocalContainer] 19.04.2016 09:47:41 WARN [com.onehippo.cms7.eforms.hst.model.FormFieldFactory.createFormField():84] Unable to instantiate field class null, falling back to default

[INFO] [talledLocalContainer] 19.04.2016 09:47:41 ERROR [com.onehippo.cms7.eforms.hst.model.Form.fromBean():585] Failed to create field for bean: Password, missing field(s) mappings?

[INFO] [talledLocalContainer] 19.04.2016 09:47:41 WARN [org.hippoecm.hst.core.container.HstComponentInvokerImpl.invokeBeforeRender():158] Component exception caught on window content with component com.onehippo.cms7.eforms.hst.components.FormStoringEformComponent: java.lang.NullPointerException at com.onehippo.cms7.eforms.hst.model.Form.registerField(Form.java:603)

[INFO] [talledLocalContainer] 19.04.2016 09:47:41 WARN [org.hippoecm.hst.core.container.AbstractBaseOrderableValve.handleComponentExceptions():299] Component exception(s) found in page request, 'Request{ method='GET', scheme='http', host='localhost:8080', requestURI='/site/theresaformsitemap', queryString='null'}'.



I created the following java, html and properties files :

  1. mycustomoverrides.cms.PasswordField.java                under the hippo-addon-eforms-demo/cms/src/main/java directory
  2. mycustomoverrides.cms.PasswordFieldModel.java      under the hippo-addon-eforms-demo/cms/src/main/java directory
  3. mycustomoverrides.cms.PasswordFieldPanel.java ( + PasswrodFieldPanel.html)    under the hippo-addon-eforms-demo/cms/src/main/java directory
  4. mycustomoverrides.cms.PasswordFieldPropertiesPanel.java ( + PasswordFieldPropertiesPanel.html + .properties)  under the hippo-addon-eforms-demo/cms/src/main/java directory
  5. mycustomoverrides.PasswordField.java   under the hippo-addon-eforms-demo/site/src/main/java directory
  6. mycustomoverrides.PasswordFieldBean.java  under the hippo-addon-eforms-demo/site/src/main/java directory
I'm able to within the CMS add a new field of type Password to a form.

I also created under hst:hst/hst:configurations

  1.  hst:components/theresaformcomponent/theresaformcomponent
    1. hst:componentclassname = com.onehippo.cms7.eforms.hst.components.FormStoringEformComponent
    2. hst:parameternames =
      1. behaviors,
      2. eforms-mailsession,
      3. eforms-from-name,
      4. eforms-from-email,
      5. eforms-to-name,
      6. eforms-to-email,
      7. eforms-use-freemarker,
      8. password
    3. hst:parametervalues =
      1. com.onehippo.cms7.eformst.hst......
      2. mail/Session
      3. Webmaster
      4. webm...@example.org
      5. Sales Representative
      6. sa...@example.org
      7. true
      8. mycustomoverrides.PasswordField
    4. hst:resourcetemplate = eforms.validation.default
  2. hst:pages/theresaformpage
    1. main/content    referenceomponent = hst:components/theresaformcomponent
    2. main/content    hst:template = passwordfield.default
  3. hst::sitemap/theresaformsitemap
    1. componentconfigurationid =  hst:pages/theresaformpage
    2. relativecontentpath = forms/theresa-form
  4. hst:sitemenus/theresaformsitemenu  
    1. pointing to theresaformsitemap
  5. hst:templates/passwrodfield.default
    1. which is a copy of the eforms.default pointing to an identical .ftl files

Ivana Pranjic

unread,
Feb 2, 2017, 4:20:47 AM2/2/17
to Hippo Community, weba...@moen.com
Hello,

I am getting the same error, I was following this guide to add a custom field to the form: https://www.onehippo.org/library/enterprise/enterprise-features/enterprise-forms/custom-form-fields.html

The field is there and I can add it to the form, but when I try to view it in the site, I get the exception mentioned. Could someone take a look and tell us what's wrong with the example? Thank you.

Ivana Pranjic

unread,
Feb 15, 2017, 5:44:08 AM2/15/17
to Hippo Community, weba...@moen.com
Hi,

I ended up overriding the getFieldClass() from AbstractFieldBean and simply returning the correct field class name. Seems like a workaround, would be nice to hear how it should be done from Hippo developers. :)

BR,
Ivana Pranjic

Jeroen Hoffman

unread,
Feb 16, 2017, 3:16:27 AM2/16/17
to hippo-c...@googlegroups.com
Hi,

I don't think your solution is so bad.

But you can also work with setting a property 'eforms:fieldclass' in the cnd, or use the static
com.onehippo.cms7.eforms.hst.model.FormFieldFactory#addFieldBeanMapping to add your custom mapping from bean to field.

So there are multiple ways.

We should at least change the documentation, thanks for the feedback!
Jeroen
> 1. mycustomoverrides.cms.PasswordField.java under the hippo-addon-eforms-demo/cms/src/main/java
> directory
> 2. mycustomoverrides.cms.PasswordFieldModel.java under the hippo-addon-eforms-demo/cms/src/main/java directory
> 3. mycustomoverrides.cms.PasswordFieldPanel.java ( + PasswrodFieldPanel.html) under the
> hippo-addon-eforms-demo/cms/src/main/java directory
> 4. mycustomoverrides.cms.PasswordFieldPropertiesPanel.java ( + PasswordFieldPropertiesPanel.html +
> .properties) under the hippo-addon-eforms-demo/cms/src/main/java directory
> 5. mycustomoverrides.PasswordField.java under the hippo-addon-eforms-demo/site/src/main/java directory
> 6. mycustomoverrides.PasswordFieldBean.java under the hippo-addon-eforms-demo/site/src/main/java directory
>
> I'm able to within the CMS add a new field of type Password to a form.
>
> I also created under hst:hst/hst:configurations
>
> 1. hst:components/theresaformcomponent/theresaformcomponent
> 1. hst:componentclassname = com.onehippo.cms7.eforms.hst.components.FormStoringEformComponent
> 2. hst:parameternames =
> 1. behaviors,
> 2. eforms-mailsession,
> 3. eforms-from-name,
> 4. eforms-from-email,
> 5. eforms-to-name,
> 6. eforms-to-email,
> 7. eforms-use-freemarker,
> 8. password
> 3. hst:parametervalues =
> 1. com.onehippo.cms7.eformst.hst......
> 2. mail/Session
> 3. Webmaster
> 4. webm...@example.org
> 5. Sales Representative
> 6. sa...@example.org
> 7. true
> 8. mycustomoverrides.PasswordField
> 4. hst:resourcetemplate = eforms.validation.default
> 2. hst:pages/theresaformpage
> 1. main/content referenceomponent = hst:components/theresaformcomponent
> 2. main/content hst:template = passwordfield.default
> 3. hst::sitemap/theresaformsitemap
> 1. componentconfigurationid = hst:pages/theresaformpage
> 2. relativecontentpath = forms/theresa-form
> 4. hst:sitemenus/theresaformsitemenu
> 1. pointing to theresaformsitemap
> 5. hst:templates/passwrodfield.default
> 1. which is a copy of the eforms.default pointing to an identical .ftl files
>
> --
> Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
>
> To post to this group, send email to hippo-c...@googlegroups.com
> RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
> ---
> You received this message because you are subscribed to the Google Groups "Hippo Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> hippo-communi...@googlegroups.com <mailto:hippo-communi...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/hippo-community.
> For more options, visit https://groups.google.com/d/optout.

Ivana Pranjic

unread,
Feb 16, 2017, 3:26:35 AM2/16/17
to Hippo Community, weba...@moen.com
Hi Jeroen,

Thank you for your answer. I did it in the cnd at first, but it seemed even more "hacky". I like the solution with addFieldBeanMapping better.

Kind regards,
Ivana Pranjic

Am Dienstag, 19. April 2016 16:56:39 UTC+2 schrieb weba...@moen.com:
Reply all
Reply to author
Forward
0 new messages