Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

How to escape left square bracket - [ and Right square bracket - ] when used in views so that it is not mistaken for a token.

I have what I hope is a simple question to answer. I have tried searching online but have been unable to find an answer (perhaps using the wrong search terms - I don't know). I am using Drupal 7 with views and the fillPDF module. I have modified one of the outputs of my view to use token replacement. The issue I am having is that the string that is being used for the token replacement has an array with an index that is the same as the token. Here is the code:

<a href="/fillpdf?fid=33&webform[nid]=[nid]&webform[sid]=[sid]">Create a PDF</a>

As you can see, I need away to make sure webform[nid] and webform[sid] doesn't become webform1 and webform2 after token replacement. How do I accomplish this? There must be a way to escape the array.

Thanks.

share|improve this question

1 Answer

up vote 1 down vote accepted

You can escape the left square bracket - [ using - %5B
and Right Square Bracket - ] using - %5D

So you should change your code in question to the following.

<a href="/fillpdf?fid=33&webform%5Bnid%5D=[nid]&webform%5Bsid%5D=[sid]">Create a PDF</a>
share|improve this answer
Remember to show the HTML as code. – kiamlaluno Jan 22 at 15:49
Thank-you! That worked perfectly! You are awesome. – user5013 Jan 22 at 20:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.