/    Sign up×
Community /Pin to ProfileBookmark

Set Form Value to Unescaped URL parameter

Hi-

I am trying, so far without success, to set a form field value to an [COLOR=Indigo]unescaped [/COLOR] URL parameter. Here is the story. A recipient of email from us click an opt-out button and jumps to an opt out page. The URL of that opt-out page has the recipient’s email address appended to the URL as a parameter. But the URL has the “@” symbol in the email encoded into “%40”, so I have to unescape it to convert the “%40” back to an “@” symbol. So the URL looks like …company.com/page/emailoptout.htm?emailname%40yahoo.com

In my header I have script to try to set my “emailoptout” form’s “email” field value to the unescaped URL parameter:

<script language=”javascript” >
function populate()
{
document.optoutform.email.value=unescape(window.location.search.substring(1));
}
</script>

But upon submission the email address is not arriving with the other form fields’ data. Can anyone help?

Thank you

Jay 😮

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KravvitzDec 16.2005 — When are you calling populate()?

[url=http://www.thecounter.com/stats/2005/November/javas.php]Keep in mind that about 10% of Internet users use a browser that doesn't have JavaScript enabled.[/url]
Copy linkTweet thisAlerts:
@jaydbauthorDec 16.2005 — Hi thanks yes that was the issue; as a total noob/non-coder i thought the fn being in the header executed it and failed to have it called in the body tag. doh! :o
×

Success!

Help @jaydb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...