CMS Development

StuGoymerIWD
Participant | Elite Partner
Participant | Elite Partner

HubDB filter breaks after 5th entry?

SOLVE

Hi there

I'm reaching out as I'm lost as to why my Hubdb filtering is working fine but only for the first 5 values?!

While this should be a good clue, I've investigated to see fi any code, or syntax is different from the first 5 and I cant find anything.

There is a State dropdown, then some Clicktotweet preproulate tweets for 2 Senators.

Alaska to California works fine - then fails at Colorado

The URL is channingg to add a +

http://protectthearctic-7330166.hs-sites.com/take-action?name=California

That works

Then all other States have a plus??

http://protectthearctic-7330166.hs-sites.com/take-action?name=+Colorado

Removing the plus in the URL show no results.

Can anyone see what is happening here?  Is this a Hub DB bug?

Here is my code:


<div class="section-inside-takeaction"></div>

<div class="section-takeaction-main">

<div class="page-center">
<div data-w-id="1b909b50-0d45-335a-08f9-63d3078cd149" style="opacity:0" class="blog-title-wrap">
<h1>TAKE ACTION</h1>
<div class="action-subhead">Petition your LOCAL senator</div>
<h3 class="action-intro-text">The Arctic National Wildlife Refuge is one of the world’s most beautiful and unspoiled landscapes and is worthy of the strongest possible protection to ensure all Americans can use it for years to come. Join the
millions of Americans taking action to protect this public land.</h3>
</div>
</div>

<!-- #Start State Dropdown Form -->
<div class="page-center">
<!-- set the filter by drop down, search bar, and submit button -->

<form id="form_id" method="get">


<select class="ta-select-state-dd w-select" name="name" form="form_id" onChange="this.form.submit()">

<option value="selected">Please Select Your State...</option>
<option value="show-all">Show All</option>
{% set names = hubdb_table_column(2618001, "name").options %}
{% for choice in names %}
{% set name_list = name_list~choice.id|list%}
{% if choice.id == request.query_dict.name%}
<option selected="selected" value="{{ choice.name }}">{{ choice.name }}</option>
{% else %}
<option value="{{ choice.name }}">{{ choice.name }}</option>
{% endif %}
{% endfor %}
</select>

</form>

</div>
<!-- #End State Dropdown Form -->

<!-- sets the different query parameters using submitted input for hubdb query -->
{% set queryparam = "" %}
{% if request.query_dict.name in ["Alaska","Alabama","Arkansas","Arizona","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"] %}
{% set queryparam = queryparam ~ "&name="~request.query_dict.name|urlencode %}
{% endif %}
{% if request.query_dict.name == "show-all" %}
{% set queryparam = queryparam %}
{% endif %}

 

<div class="page-center">


{% set table = hubdb_table_rows(2618001, queryparam) %}


{% if table == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your filter and search again.</p>
{% else %}
{% for row in table %}

<style>

.state-name { padding:50px; text-align: center }

</style>

<div class="state-name">
<h3>Tweet your {{ row["name"].name }} State Senators</h3>
</div>

</div>

<div class="{{ row["name"].name }}">

<div class="ta-tweet-results">
<div class="ta-tweet-tltle">Tweet your local senators</div>
<div class="ta-tweet-result-box">
<div>
<h3>{{ row["senator_twitter_1"] }} | {{ row["name"].name }} State Senator</h3>

{{ row["senator_twitter_1"] }} We need your support! Together, we can protect the Arctic National Wildlife Refuge. Find out more today <a href="https://ctt.ac/Ypahm+">https://ctt.ac/Ypahm+</a> #protectthearctic

</div>
<div class="ta-email-button-wrap w-clearfix"><a href="https://twitter.com/intent/tweet?text={{ row["senator_twitter_1"] }}%20We%20need%20your%20support%21%20Together%2C%20we%20can%20protect%20the%20Arctic%20National%20Wildlife%20Refuge.%20Find%20out%20more%20today%20https%3A%2F%2Fctt.ac%2FYpahm%2B%20%23protectthearctic&original_referer=https://clicktotweet.com&related=tweetdripapp" class="btn email w-button">tweet now</a></div>
</div>
<div class="ta-tweet-result-box _2">
<div>

<h3>{{ row["senator_twitter_2"] }} | {{ row["name"].name }} State Senator</h3>

{{ row["senator_twitter_2"] }} We need your support! Together, we can protect the Arctic National Wildlife Refuge. Find out more today <a href="https://ctt.ac/Ypahm+">https://ctt.ac/Ypahm+</a> #protectthearctic

</div>
<div class="ta-email-button-wrap w-clearfix"><a href="https://twitter.com/intent/tweet?text={{ row["senator_twitter_1"] }}%20We%20need%20your%20support%21%20Together%2C%20we%20can%20protect%20the%20Arctic%20National%20Wildlife%20Refuge.%20Find%20out%20more%20today%20https%3A%2F%2Fctt.ac%2FYpahm%2B%20%23protectthearctic&original_referer=https://clicktotweet.com&related=tweetdripapp" class="btn email w-button">tweet now</a></div>
</div>
</div>

</div>

{% endfor %}
{% endif %}


</div>

 

0 Upvotes
1 Accepted solution
StuGoymerIWD
Solution
Participant | Elite Partner
Participant | Elite Partner

HubDB filter breaks after 5th entry?

SOLVE

Wowzers!

So I have fixed it by checking DB entry for Name.  There were spaces at the front from Colorado onwards, creating the +

I copy and pasted and entire State list, then cut each one

That was because I can find no easy way to import a Select list

View solution in original post

1 Reply 1
StuGoymerIWD
Solution
Participant | Elite Partner
Participant | Elite Partner

HubDB filter breaks after 5th entry?

SOLVE

Wowzers!

So I have fixed it by checking DB entry for Name.  There were spaces at the front from Colorado onwards, creating the +

I copy and pasted and entire State list, then cut each one

That was because I can find no easy way to import a Select list