CMS Development

cives
Contributor

Use information submitted on one module in another one

Hi all, i'm trying to pass the value from a choice field in one module to another.

 

Use case: The user selects a member type, the web page renders quick facts about that member sector and passes that same member type to another module that renders board members from within that member type

 

My intention is to create a parameter to query hubDB and the data from the other module and use in a for loop.

 

I keep getting errors. 

 

{% set queryparam = "&orderBy=-priority&orderBy=last_name&board__contains=" ~ content.widgets.member-type-facts.member_type.value %}

 

Is something off with my formatting? Thanks,

0 Upvotes
2 Replies 2
cives
Contributor

Use information submitted on one module in another one

Thankfully, I have made some progress — though I'm still caught up on one issue that I've been troubleshooting for a while.

 

I've opted to create a seperate template so that I can use the export_to_template_context; that has worked well. 

 

On the template I use:

{% choice "type", label="Choose Type", value="New Car", choices="New Car, Used Car, Auto Body, Repair Shop", export_to_template_context=True %}

 To obtain the correct filter, I then use the value in a queryparam:

{% set queryparam = "&orderBy=-priority&orderBy=last_name&member_category__contains=" ~ widget_data.type.value %}

 

Then, I use it in a loop to list board members that meet the criteria of the filter:

 

 {% for row in hubdb_table_rows(2639534, queryparam) %}
[html here]
{% endfor %}

 

Everything works perfectly, it pulls the correct HubDB row, however it never pulls more than one row, even in instances where it should. I've tried adding &limit=100 to the queryparam with no luck. 

 

Any guidance is greatly appreciated. Thanks,

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Use information submitted on one module in another one

Hi, @cives 👋 Were you able to make any progress? 

 

If not, I have a few questions:

  • Can you tell the community more about the structure of the data in your HubDB table, specifically related to the board__contains filter?
  • Have you tried hard-coding a value in place of content.widgets.member-type-facts.member_type.value? To help determine if the issue lies in retrieving the value from the module
    {% set queryparam = "&orderBy=-priority&orderBy=last_name&board__contains=hardcodedValue" %}
    
  • Can you share an example of the error message you get back?

Thanks for the additional details! — Jaycee

 

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes