Jun 19, 2020 3:43 AM
I have a strange issue with using query parameters as text on a website page.
Sometimes they do not work / show on the page altough they are visible in the URL.
Here are some code examples.
On a first page I create a link with the parameters. The URL looks like:
https://www.website.com/nl/webinars?webinar_info=Title of Webinar - Monday 1 July 2020&webinar_id=1234567
On the next page I want to use that information on the page. The code snippets for that are:
{% set webinars = hubdb_table_rows(2625480) %}
{% set current_webinar = webinars|selectattr('hs_id','equalto', Query.webinar_id) %}
{% if current_webinar | length > 0 %}
{% for webinar_detail in current_webinar %}
{{ webinar_detail.video_title }}
{{ webinar_detail.date | datetimeformat('%A %e %B %Y') | capitalize }} # show the date
When I do a check on current_webinar, then current_webinar is empty [].
The strange thing is... It worked before and on another page we use the exact same code and there it works. Does somebody know how or why this can happen?
Jun 19, 2020 9:00 AM
@Klaasie it might be due to the uppercare "Query". I've had issues with a similar issue in the past. Also, you should use the official query variable which is "request.query" or "request.query_dict".
Jun 19, 2020 10:04 AM - edited Jun 19, 2020 10:05 AM
Thanks for your reply Stefen. I have tried both "request.query" and "request.query_dict".
But it looks like the hs_id can't be matched with the webinar_id in the url
{% set webinars = hubdb_table_rows(2625480) %} {% set current_webinar = webinars|selectattr('hs_id','equalto',request.query_dict.webinar_id) %}
When I copy the URL, then it looks like this, which looks okay
https://www.website.com/nl/webinar?webinar_info=Title%20-%20Subtitle%20-%20Monday%2015%20June%202020&webinar_id=30575767146
Jun 19, 2020 10:18 AM
There seems to be some sort of delay in Hubspot. After changing the code and doing some browser refreshes with F5 and CTRL+F5 it still didn't work. And now a few minutes later it does work. Weird