Getting a FormBean from a HippoDocument

38 views
Skip to first unread message

Nils Zonneveld

unread,
Apr 10, 2014, 5:28:37 AM4/10/14
to hippo-c...@googlegroups.com
Does anyone know how do I get a FormBean from a HippoDocument object?

Eray

unread,
Apr 11, 2014, 3:21:14 AM4/11/14
to hippo-c...@googlegroups.com
In hippo go green project there is a SimpleDocument class. It has form property and get it like that :

public FormBean getForm() {
        HippoMirror mirror = getBean(Constants.PROP_FORM);
        if (mirror == null) {
            return null;
        }
        return (FormBean) mirror.getDeref();
    }

Best Regards,
Eray.

10 Nisan 2014 Perşembe 12:28:37 UTC+3 tarihinde Nils Zonneveld yazdı:

Wouter Danes

unread,
Apr 11, 2014, 4:15:30 AM4/11/14
to hippo-community
What are you trying to do?

Wouter Danes
Solutions Architect
HintTech Mastering the value of content
Mastering the value of content
creative | technology | content
Delftechpark 37i
2628 XJ Delft
The Netherlands
T:+31 88 268 25 00
M:+31 6 1158 8264
Website Twitter Facebook LinkedIn


On Thu, Apr 10, 2014 at 11:28 AM, Nils Zonneveld <nilszo...@gmail.com> wrote:
Does anyone know how do I get a FormBean from a HippoDocument object?

--
*** The 2014 Hippo GetTogether will take place on May 16 in Amsterdam, register at http://hgt14.onehippo.org ***
 
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.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Eray

unread,
Apr 11, 2014, 4:30:26 AM4/11/14
to hippo-c...@googlegroups.com
You should use getReferencedBean() insteaf of getDeref() because in javadoc :

WARNING: A deref breaks out of the virtual context, and might return you a node structure, where you find published and unpublished nodes. Recommended to use is getReferencedBean(). Note that this might return you a handle containing both live and preview documents. You should not use this method to get a linked item. Use getReferencedBean().

11 Nisan 2014 Cuma 10:21:14 UTC+3 tarihinde Eray yazdı:

neha malhotra

unread,
Jul 19, 2017, 6:45:06 AM7/19/17
to Hippo Community
Hi team,

Kindly update how can i get FormBean from HippoDocument Object, I have Object which has document path as /forms/contactus. Now I want to have this converted to Form bean and then rendered by ftl

neha malhotra

unread,
Jul 19, 2017, 7:01:04 AM7/19/17
to Hippo Community

Note:- This is not available. Are there any updates:


public FormBean getForm() {
        HippoMirror mirror = getBean(Constants.PROP_FORM);
        if (mirror == null) {
            return null;
        }
        return (FormBean) mirror.getDeref();
    }

On Thursday, April 10, 2014 at 2:58:37 PM UTC+5:30, Nils Zonneveld wrote:

neha malhotra

unread,
Jul 20, 2017, 1:10:54 AM7/20/17
to Hippo Community
Kindly update on the same

Jeroen Hoffman

unread,
Jul 20, 2017, 3:36:32 AM7/20/17
to hippo-c...@googlegroups.com
Hi Neha,

It looks like the given code tries to get a form bean from a regular document's bean that has a link to a form document.
This is a pretty standard way of implementing Enterprise Forms but there is an easier way to do it:

public FormBean getForm() {
return this.getLinkedBean("relativePath", FormBean.class);
}

Next would be to use a component that extends EformComponent and overrides #getFormBean(HstRequest request) to call that
getForm() method from the document's bean.

HTH
Jeroen
> --
> 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.

neha malhotra

unread,
Jul 21, 2017, 7:16:37 AM7/21/17
to Hippo Community
Thanks.

Was able to resolve the issue by overriding the formbean and creating document like:

String formPath = request.getRequestContext().getAttribute("formPath").toString();
        final HippoBean document =  request.getRequestContext().getSiteContentBaseBean().getBean(fp);

where formPath is browsed form document path.

Thanks,
Neha

On Thursday, April 10, 2014 at 2:58:37 PM UTC+5:30, Nils Zonneveld wrote:
Reply all
Reply to author
Forward
0 new messages