1

I'm attempting to submit lat|long coordinates from a Low Search form. I've got Low Search configured to use GET variables instead of encoding the query. When I submit the search form the pipe character that delimits my lat|long values is getting converted to "%257C" in the query string.

My Low Search form:

{exp:low_search:form 
    query="{segment_3}"
    form_id="home_search"
}
<input type="hidden" id="distance_from" name="distance:from" value="" />
<input type="search" name="search:organization_name" placeholder="organization name" />
<input type="search" name="keywords" placeholder="keyword" />
<input type="search" id="zipcode" name="zip" placeholder="zipcode" />
<button type="submit">GO</button>
{/exp:low_search:form}

The distance:from field is being populated by AJAX geocoding response, but the same thing happens when I hardcode a string into the distance:from field like this:

<input type="hidden" id="distance_from" name="distance:from" value="30.2966026|-97.9701846" />

The resulting URL looks like:

/search/results/?distance:from=30.2966026%257C-97.9701846&keywords=foo

...and the search results page shows a PHP error:

A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: distance/lsf.distance.php
Line Number: 70

If I manually change "%257C" to "|" in the URL the search results page works properly.

Any suggestions? I've tried adding the pipe character to $config['permitted_uri_chars'] but that has no effect on this issue.

3
  • It looks like the pipe character is being URL encoded twice. A URL-encoded pipe is %7C. A percent sign URL-encoded is %25. LS doesn't URL-encode the query string itself, so it probably happens somewhere else. If you populate the distance:from parameter manually, does that work? Also, does the same behaviour occur in all browsers, like Chrome, Firefox, IE, etc?
    – Low
    Commented Mar 22, 2015 at 20:25
  • Thanks Low. Looks like Safari is converting the pipe character to "%257C" after submitting the form, and Chrome is converting it to "%7c". Commented Mar 23, 2015 at 14:54
  • If I hardcode "30.2966026|-97.9701846" into the form field in the template, refresh the page, and submit the form I get the same results in both Safari and Chrome. This is only an issue when the Encode Query setting is turned off. It works properly when the query string is encoded, so for now I've changed that setting. Commented Mar 23, 2015 at 15:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.