Getting FormBean instead a Form model

Hi All,

I am quite new here. Bear with me please.

I try to create a custom document page with an eForm inside. This eForm will be a link based on the compound document element. Issue that I get, the instance when I get it on the ftl, it FormBean(com.onehippo.cms7.eforms.hst.beans.FormBean) instead of Form (com.onehippo.cms7.eforms.hst.model.Form).

As I need it to be com.onehippo.cms7.eforms.hst.model.Form, I tried to cast it using below on my ftl but seems didn’t work.
<#-- @ftlvariable name=“document.sectionContact.contactForm.form” type=“com.onehippo.cms7.eforms.hst.model.Form” -->

Please advise. Thank you!

Hi,
There should be a form component that parses the request into a Form (model), based on the bean (the form instance) but then filled with actual values (empty on first render).
So what component are you using? When custom, extending from com.onehippo.cms7.eforms.hst.components.BaseEformComponent, you may need to override #getFormBean() to follow the link in your document.

HTH
Jeroen

Hi Jeroen,

Thank you for response. On my page component, I extending EssentialsContentComponent that does the doBeforeRender and get the contentBean of a class that extending BaseDocument.

This public class CustomPage extends BaseDocument {
}

has methods of getting some beans of HippoCompound. Let’s say heroSection, contactSection, and footerSection.

In the contactSection bean, there is a method to getContactForm that return a FormCompound which described below:

@HippoEssentialsGenerated(internalName = "company:formcompound")
@Node(jcrType = "company:formcompound")
public class Formcompound extends HippoCompound {
    @HippoEssentialsGenerated(internalName = "company:form")
    public HippoBean getForm() {
        return getLinkedBean("company:form", HippoBean.class);
    }
}

this getForm that giving me FormBean instead of Form model.

Hi,
The thing is that EssentialsContentComponent isn’t parsing the request into a form model. That is done by com.onehippo.cms7.eforms.hst.components.EformComponent and also by AutoDetectFormComponent which is a subclass that is usable in the Channel Manager as droppable component.

So normally there is a separate component with (sub)configuration for the forms.

Jeroen

Hi Jeroen,

Thank you for the inputs.

I managed to get the Form model now. Manage to extend AutoDetectFormComponent and override getFormBean to get from linkedBean instead. I can see the form now displayed via eform-default.ftl.

I still facing issue where the POST validation request is 404. I can see it indeed hit BaseEformComponent@doBeforeServeResource correctly and “validation” is found under resourceID.

Is it something to do with my sitemap configuration on console? which should accept query param? FYI, the sitemap that I have prepare for this document is meant for a dynamic under /partner, the new page will be something /partner/google or /partner/facebook. So far the pages created with expected path.