Culex Posted December 17, 2013 Report Share Posted December 17, 2013 Hello Caspio Forum! First post here. One of my links include the following instruction to pass a variable: <a id="mylink" href="culex.ca/client-portal/administration-login/forms-and-reports/adult-and-species-id-form&cbResetParam=1&TPSampleID=" onclick="window.open(this.href, 'mywin','left=20,top=20,width=1100,height=800,resizable=0'); return false;"target="_blank">Click here to Open Species Form</a> Note: I removed the "http://www" here so the link is displayed complete. Unfortunately the instructions in the URL get encoded like this in my webpage: "%26cbResetParam%3D1%26TPSampleID%3D" I tried using URLEncoder like this: <a id="mylink" href="http://www.culex.ca/client-portal/administration-login/forms-and-reports/adult-and-species-id-form&cbResetParam=1&TPSampleID=" + URLEncoder.encode("&cbResetParam=1&TPSampleID=", "ISO-8859-1"); onclick="window.open(this.href, 'mywin','left=20,top=20,width=1100,height=800,resizable=0'); return false;"target="_blank">Click here to Open Species Form</a> but the problem remains the same. Any ideas how to fix this one? Thank you D Anthonyjulk 1 Quote Link to comment Share on other sites More sharing options...
MayMusic Posted December 20, 2013 Report Share Posted December 20, 2013 Did you try <input type="button" value="Click here to Open Species Form" onclick="window.location='culex.ca/client-portal/administration-login/forms-and-reports/adult-and-species-id-form&cbResetParam=1&TPSampleID='" /> Quote Link to comment Share on other sites More sharing options...
Culex Posted December 24, 2013 Author Report Share Posted December 24, 2013 Hi MayMusic, Sorry for taking so long to thank you for your answer. The crazy days of holidays! Unfortunately I still have the same problem (i.e., the link encodes the url improperly). Do you have any experience working with URLEncoder? Thank you and Happy holidays! D Quote Link to comment Share on other sites More sharing options...
MayMusic Posted December 31, 2013 Report Share Posted December 31, 2013 I am not sure about encoding but this link is not correct culex.ca/client-portal/administration-login/forms-and-reports/adult-and-species-id-form&cbResetParam=1&TPSampleID= try to have the full link including http and also change the first & to ? Quote Link to comment Share on other sites More sharing options...
NarayanJr Posted January 6, 2014 Report Share Posted January 6, 2014 I dont know a whole lot about encoding URLs but I did recently work through my own issue using javascript's encodeURI and and looking at the encoded url that is correct. "%26cbResetParam%3D1%26TPSampleID%3D" %26 = "&" %3D = "=" It looks like it is encoding it correctly. If you want it to look like this "culex.ca/client-portal/administration-login/forms-and-reports/adult-and-species-id-form&cbResetParam=1&TPSampleID=" when it gets to your page, you may have to use the decode function which should replace all the %26 and %3D back to & and =. This is javascript based though and it looks like "URLEncoder.encode" is part of Java, but there should be a similar answer for straight Java. You may just receive the encoded url and use code on the website to decode it and pull the passed parameters that way. http://www.w3schools.com/jsref/jsref_decodeuri.asp http://www.w3schools.com/tags/ref_urlencode.asp Quote Link to comment Share on other sites More sharing options...
ShWolf Posted January 9, 2014 Report Share Posted January 9, 2014 Hi NarayanJr, Try this: <a id="mylink" href="http://culex.ca/client-portal/administration-login/forms-and-reports/adult-and-species-id-form?cbResetParam=1&TPSampleID=" onclick="javascript:window.open(this.href, 'mywin','left=20,top=20,width=1100,height=800,resizable=0'); return false;"target="_blank">Click here to Open Species Form</a> Is this what you need? Quote Link to comment Share on other sites More sharing options...
Culex Posted January 12, 2014 Author Report Share Posted January 12, 2014 Hello MayMusic, NarayanJr and ShWolf, Thank you for all your suggestions. You were right. The problem was the "&". I figured it thanks to my account manager. I just changed this: <a id="mylink" href="http://culex.ca/client-portal/test-2/&cbResetParam=1&TPSampleID=" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=1100,height=800,resizable=0'); return false;"target="_blank">Click here to Open Species Form</a> to <a id="mylink" href="http://culex.ca/client-portal/test-2/?cbResetParam=1&TPSampleID=" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=1100,height=800,resizable=0'); return false;"target="_blank">Click here to Open Species Form</a> cheers Culex Quote Link to comment Share on other sites More sharing options...
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.