Drupal's url() is changing the '[' to %3 ... and breaking the prepopulate urls. Any ideas on what to do about this?

Thanks for a great module.

Comments

lelizondo’s picture

in my case it breaks the '?' and the '=' it changes them to %3F.. still don't know how to solve this.

bentonboomslang’s picture

Version: 6.x-1.1 »

This is happening with me too.

Surely others must have solved this...

Thanks,

Ben

lelizondo’s picture

I'm using this code to prepopulate a field:

$project = arg(1);
$populate = l('+ '. t('Create !type', array('!type' => $link['title'])), $link['href'], array('query' => 'edit[field_project_ref][0][nid]='.urlencode($project)));

In this case using array('query' ... solved the mystery.

bentonboomslang’s picture

This worked tremendously.

Thanks a lot lelinzondob.

Ben

jbrauer’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

tpainton’s picture

Is there another way to do this.. It seems to be my problem as well. I am using computed field to generate a url that should prepopulate but the ampersand is getting turned into %26 and once this happens, the link no longer works.

It seems this solution works, but I am not sure how to modify it to my needs. Seems like prepopulate should do this for you? Feature request?

dkoukoul’s picture

Hi,
where is this code added in order to prepopulate the field?

lelizondo’s picture

it depends... in my case the link was in template.php since I was overriding a function and that's where I put it, but if you have the link in a block, there's where you need to add the code.