I'm trying to use the webform to redirect to a page where the url determines the content of the page.

I have the custom url like this:

find-locations?country=%safe_key[countrylist]&category=All&store_name=&store_id=%value[storeid]&distance[distance]=100&distance[unit]=3959&distance[origin]=

if the store id field is blank, it spits out the following url with the space(%20) after "store_id=". See the URL it passed below:

find-locations?country=All&category=All&store_name=&store_id=%20&distance[distance]=100&distance[unit]=3959&distance[origin]=&sid=93

How do i fix this?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

debo7debo’s picture

Assigned: debo7debo » Unassigned
debo7debo’s picture

Priority: Major » Critical
debo7debo’s picture

Title: submission of blank textfields passes a "space/%20" in custom url redirect » submission of blank textfields passes a WHITE SPACE in custom url redirect
debo7debo’s picture

Issue summary: View changes

removed the local server domain name from the results

quicksketch’s picture

Title: submission of blank textfields passes a WHITE SPACE in custom url redirect » Submission of blank textfields passes a WHITE SPACE in custom url redirect
Version: 7.x-3.18 » 7.x-3.20
Issue summary: View changes
Priority: Critical » Normal

I've confirmed this issue still exists for both the 3.x and 4.x versions of the module, but this is not a critical issue. I'm suspecting that there may be some HTTP spec reason for adding the spaces in here, because Webform isn't doing it by itself. It's either Drupal or the web browser that is adding these spaces. EDIT: Nope, it's Webform. See patch in next comment.

To solve this issue, we may need to simply not include those parameters at all if they're empty.

quicksketch’s picture

Thanks to the recent issue at #1244072: Use of tokens in external URL redirect locations not allowed in some cases and not URL Encoded, fixing this in the 4.x version is trivial. Solving in 3.x could be similarly done, but with the token handling completely different, I haven't gotten around to fixing this in 3.x. Any patches to fix 3.x would be appreciate. This patch has been committed to 4.x to solve the problem there.

quicksketch’s picture

Status: Active » Closed (fixed)

This probably isn't going to get fixed in 3.x. Any patches are still welcome, but with 4.0 around the corner I'd recommend upgrading.

fenstrat’s picture

Version: 7.x-3.20 » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Closed (fixed) » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-3.20
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed and pushed 427e569 to 8.x-4.x. Thanks!

  • Commit dfc426e on 8.x-4.x authored by quicksketch, committed by fenstrat:
    Issue #1897114 by quicksketch: Submission of blank textfields passes a...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ymeiner’s picture

FileSize
864 bytes

I had to fix it for 7.x-3.x, created a patch for it for others to use,

enjoy