1

I'm creating a custom profile center using landing pages and ampscript.

When I submit my form to itself the data is properly processed with ampscript. But the "qs" parameter is no longer available in the URL and therefore I have no means of returning the subscriber to a personalized page. I tried doing a RequestParameter("qs") and QUERYPARAMETER("qs") to retrieve the value and pass it on to the submission page but I seem to be unable to capture that value.

Is there a better way to pass or retrieve this value after submitting a form?

Thanks,

  • Have you tried setting the value of QS outside of the form, so that the value remains no matter the refresh? – Eduardo Arias Oct 27 '14 at 22:18
1

Just exclude the action parameter of the <form> altogether. When no action is present browsers will submit to the current documents address.

 <html>
    %%[
        IF RequestParameter("submitted") == "submitted" THEN
            Output(Concat("Form submitted with ", RequestParameter("var1")))
        ENDIF
    ]%%
    <body>
    MID hidden in QS: %%memberID%%
        <form method="post">
            <input type="text" name="var1"/>
            <input type="hidden" name="submitted" value="submitted"/>
            <input type="submit">
        </form>
    </body>
</html>

This will leave your QS parameter as it was when the Subscriber first hit the page; so if you use MicrositeURL AMPscript function with additional parameters, it'll always be passed.

| improve this answer | |
  • Yes! That did the trick. Odd though that ET's Ampscript Custom Profile Center Code doesn't do this. It inputs "RequestParameter('PAGEURL')" into the action attribute which submits the page to itself without passing any current parameters. – Jason Oct 28 '14 at 12:57
  • Are you sure? When you don't use a personalised URL, the Platform only knows which page to load based on the QS parameter. If it didn't pass the QS parameter the platform won't be able to load the page... unless it sends it via POST or something? – David Murphy Oct 28 '14 at 22:52
  • The code is referenced here: help.exacttarget.com/en-US/technical_library/web_service_guide/… There is no attempt in the code to pass the qs value in GET or POST. Then again, used as-is, this code example doesn't work... But my findings tell me you can't grab that qs and pass it through GET/POST anyway. – Jason Oct 29 '14 at 13:05
  • The code you're referencing is old, at least as old as the three years I've worked here ;), there has been updates to the MicrositeURL during that time which may render old code like that non-functional. One other bit of advice I can suggest is to keep your processing code and front-end code separate, in like two separate pages. That way your front end can submit details to the back-end via AJAX. You won't need to worry about additional form parameters other than the stuff you're capturing and referencing that way. – David Murphy Oct 30 '14 at 4:38
1

The question is why do you want to pass that whole value. Reason being is that it's simply an encrypted payload which includes reference to the subscriber + few default attributes + potentially additional attributes you might have passed if you've used MicrositeURL function when that link was initially generated.

If you need to pass same parameters to your processing page there are two ways: 1. as you've found out and as mentioned by @David - submit the page to itself. 2. have a separate processing page, but use MicrositeURL function in the email to generate link to it and then include that link into your profile center URL as one of the request parameters. This way you can retrieve it on the form page and use for action attribute on the form.

So consider your email content (assuming that is how you do get your current page URL):

...
%%[
    SET @processingPageURL = MicrositeURL(NNX, "attr1", "value1", "attr2", "value2")
    SET @preferenceCenterURL = MicrositeURL(NNZ, "processingURL", Base64Encode(Replace(@formURL, "=", "_")))
]%%
<a href="%%=RedirectTo(@preferenceCenterURL)=%%">To the preference center</a>
...

Now within your preference center page you can have following:

...
%%[
    SET @formURL = RequestParameter("processingURL")
    SET @formURL = Base64Decode(Replace(@formURL, "_", "="))
]%%
<form action="%%=RedirectTo(@formURL)=%%" method="POST">
...

That should do the trick :)

P.S. the encode/decode Base64 along with replacement of the = with _ and backwards will ensure that you pass allowed text. Thanks to David for helping me with that earlier.

| improve this answer | |
  • Thanks, more than I need at the moment but this will certainly be helpful with some upcoming scenarios. – Jason Oct 28 '14 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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