Extending Form Document Type

Version: brXM 14

Currently I am trying to implement a solution for our CMS users to be able to group Form fields into rows(inputs will be rendered in HTML on one row). In order to facilitate this, I need a field in the Form document that CMS users can use to group fields together. I’ve been trying to amend the “Page” field into a “Row”. The functionality could potentially remain the same as a “Page” field, but have different labels. My problem is as follows:

Using this guide: Creating custom form fields - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS

After setting everything up according to the guide, I can create a new field that uses “eform:textfield”, but creating a new field that uses “eform:page” doesn’t work. Here is my module’s .cnd file:

image

This is the same node definition that “eforms:page” uses. I have also tried using “[cm:Row] > eforms:page”, which yields the same result.
The new “Row” field appears in the “Form” document.

The problem occurs when trying to drag the “Row” field into the form. This is the error message:

I have tried many things to solve this problem but can’t seem to crack it. Any insight into how to deal with this would be greatly appreciated! Please let me know if additional images/info would be helpful.

So a very general answer, but the error is saying the element you are trying to add is not allowed by the definition in the cnd. The problem isn’t in the cnd you show, but in the parent you are trying to drag the row onto. It doesn’t allow children of the type cm:Row.

So that means that the ‘com.onehippo.cms7.eforms.cms.form.FormPlugin’(which seems to be the parent in this case) won’t accept form items that inherit from ‘eforms:page’; meaning i need to change strategies?

It’s about cnd types. It means the type of the parent node, which I’m guessing should be eforms:form. Havng a quick look in the eforms cnd, there is no place where an eforms:page is a sibling of an eforms:form. So what you are doing won’t work because that is not what the type is meant for. So what you want to do in this case won’t work.

But eforms already has a group to allow you to group fields. It’s listed as a field with the other fields, and is called group.

The group field was the first field I tried using, but it ended up being inappropriate since you cannot add a group into another group. The group field functionality is somewhat different than what I need, since it’s for creating a subsection of a form, with a header.

I merely need a way for CMS users to be able to denote that certain inputs go together on one row. If it were possible to add group fields within group fields, I could use that, but that action is prevented by validation in com.onehippo.cms7.eforms.cms.dragdrop.dragdrop.js:

i’m unsure if i can amend that

“Page” is a field already in the Form document type, so it must be accepted somehow?
am I looking at the wrong .cnd?

I’m not married to the idea of using “Page” as the field type to copy, just trying to understand everything…