I am trying to solve an issue with a parameter with an ampersand in the value being passed to a url. I did some research on this forum and found an answer that gets me closer, but still doesn't quite work.
var protocol = 'http://';
var base_url = 'xxxxxxx.caspio.com/dp/d86e500027f87dfc582049xxxxxx';
var param = 'Opportunity_Name';
var qStringVal = `[@field:Opportunity_Name]`;
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Empowering
I am trying to solve an issue with a parameter with an ampersand in the value being passed to a url. I did some research on this forum and found an answer that gets me closer, but still doesn't quite work.
<a id="link-[@cbRecordIndex]" target="_blank"> Worksheet </a>
<script>
var protocol = 'http://';
var base_url = 'xxxxxxx.caspio.com/dp/d86e500027f87dfc582049xxxxxx';
var param = 'Opportunity_Name';
var qStringVal = `[@field:Opportunity_Name]`;
document.querySelector('#link-[@cbRecordIndex]').href = `${protocol + base_url}/?${param}=${encodeURIComponent(qStringVal)}`;
</script>
The parameter [@field:Opportunity_Name] is "Munis & EnerGov". The resulting url from the code above is :https://xxxxxxxx.caspio.com/dp/d86e500027f87dfc582049xxxxxx/?Opportunity_Name=Munis%20%26amp%3B%20Energov" and the parameter that is received to the other datapage is "Munis & EnerGov". So, the & is coming in, which is great, but how do I get rid of the "amp;"?
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.