CMS Development

RAFA3L
Member

Nested modules

Hello, is possible call one module from another module in the Landing page editor?

 

For example, a custom module with two placeholders and then in the Landing Page editor, after drag it to the page I would like a text field in one side and select any existing form (or any custom module) in the other side.

 

Thanks in advance

0 Upvotes
7 Replies 7
Jsum
Key Advisor

Nested modules

@RAFA3L,

 

I'm not exactly following you so you might need to explain a bit better, but here is what I think you are needing:

 

You are wanting a module that contains a rich text editor on one side and a form selector on the other?

 

You can create this as a custom module. Use custom html and generically style it in your stylesheet so it can be used anywhere. Use the custom module rich text field but for the form you can place a HubL widget like you would on a custom coded page. Find it here.

 

Does that help?

0 Upvotes
RAFA3L
Member

Nested modules

Thanks Jsum,

 

Yes, this is the main idea, but I would like to select the form widget in the options of the custom module when I'm creating the landing page. Like a custom generic module with a select field where I can choose any existing (or restricted) form in the Hubspot account.

 

This is close of what I want, but I see unnecessary create one module for each form

 

https://community.hubspot.com/t5/COS-Design-Support/Using-a-module-inside-a-custom-module/td-p/7377

 

Maybe the solution is embeding the widget form in a text field manually, but a select field is more practical.

 

I already have several modules with 1, 2, 3 and 4 columns, with custom fields and styles, I would like is a simple generic module with 2 columns and the option to select a form widget to display it in any column. Right now the only way is dragging the form widget to a template placeholder, not inside a custom module.

 

For example, selecting a form in the options put it in the Block 1

 

Screen-Shot-2017-08-10-at-5.56.14-PM.jpg

 

 

0 Upvotes
Jsum
Key Advisor

Nested modules

@RAFA3L,

 

I see. assuming that you will not always need a form, or the form is not always in the same spot, you will need the following:

 

1. Boolean check boxes (available in custom module) - use conditional logic to check if the box is checked. If checked show form controls for that block.

 

2. Form controls that only show if form box is checked. For this you can place the form widget and all markup specific to the form in the (if form_box_checked) section of your logic. This way if the check box is not checked then none of the code in the checked portion of your code will process so no form controls will exist in the editor.

 

That should do what you need. Have you tried this?

0 Upvotes
RAFA3L
Member

Nested modules

The checkbox is not important for now, the screen was an example to show the area where I want place the form. This HubL code allow me place only a specific form calling it with the ID, so in this case I need to create one module for each form and each style and number of columns. This is not the idea.

 

The red field indicated in the screen would be a select list popuplated with all the form in the Hubspot account, selecting any form there, put it in the column or module placeholder.

 

Is there a way to create a select field and populated it with all the existing forms name|ID automatically? Then I can override the ID in the HubL code with the selected form.

 

In last case I can create or update the select list field manually after each form is created, is not the idea but will work.

0 Upvotes
Jsum
Key Advisor

Nested modules

@RAFA3L,

 

Ah ok.

 

Have you tried the Hubl code for the form? while there is the options to have a default form, that code creates the option in the editor to choose/replace/create a form. It should lock you into any specific form. You don't even need to include a form id for a default form. 

0 Upvotes
RAFA3L
Member

Nested modules

Sorry Jsum, I had pasted the complete code from the HubL reference and the options did not appear, and maybe the second example doesn't work (Block Syntax Example), with only the second line work perfect, but only if I have the form code in the module. Without any other field I can edit the form in the page editor left panel. But if I add any field, the form options disappear in the page editor and only show the new field in the left panel, the form options disappear, in the right panel (preview) show the default form and the fields but now I can't edit the form.

0 Upvotes
RAFA3L
Member

Nested modules

Duplicated post

0 Upvotes