Populating a [[U0]] session tag with a javascript/jquery based value
I'm working on a donation form in Luminate. The donation form is being iframed into a pagebuilder page that contains some imagery and brand messaging.
Currently, I have a URL variable that's get passed to the donation form. Then, within the donation form there is an AJAX call being made against that variable that returns an array of data. This is allowing me to pre-populate a lot of the form fields for the constituent ahead of time. This all works wonderfully within the iframe.
I've now been asked to surface that constituents first name into the parent page that houses the iframe. I can't do this with the S-tag that calls first name because these constituents aren't logged in and some may not even have a constituent record to begin with,
At this point I've tried putting an onload function call on the iframe so that my parent page function will only run once the iframe finishes loading. This doesn't because the AJAX call still hasn't completed and the function returns an undefined value. I've tried setting an HTML5 local storage variable within the iframe and trying to access it from the parent page. Same issue, when the script runs in the parent page the value hasn't yet been returned by the AJAX call resulting in an undefined value.
I then started wondering could I just pass my name variable through a [[U0]] tag? Let's say I've stored my first name value as "fName". I've attempted to set that value in this fashion...
[[U0:testVar=fName]]
But then realized of course it's just going to house that in plain text, not actually referencing my variable value.
Documentation on these tags is sparse to non-existent. Anyone ever tried to do a session var with a javascript based value before?
Currently, I have a URL variable that's get passed to the donation form. Then, within the donation form there is an AJAX call being made against that variable that returns an array of data. This is allowing me to pre-populate a lot of the form fields for the constituent ahead of time. This all works wonderfully within the iframe.
I've now been asked to surface that constituents first name into the parent page that houses the iframe. I can't do this with the S-tag that calls first name because these constituents aren't logged in and some may not even have a constituent record to begin with,
At this point I've tried putting an onload function call on the iframe so that my parent page function will only run once the iframe finishes loading. This doesn't because the AJAX call still hasn't completed and the function returns an undefined value. I've tried setting an HTML5 local storage variable within the iframe and trying to access it from the parent page. Same issue, when the script runs in the parent page the value hasn't yet been returned by the AJAX call resulting in an undefined value.
I then started wondering could I just pass my name variable through a [[U0]] tag? Let's say I've stored my first name value as "fName". I've attempted to set that value in this fashion...
[[U0:testVar=fName]]
But then realized of course it's just going to house that in plain text, not actually referencing my variable value.
Documentation on these tags is sparse to non-existent. Anyone ever tried to do a session var with a javascript based value before?
Tagged:
0
Comments
-
Would still be curious if in practice you can initialize a [[U0]] value with JS, but I arrived at a solution outside of the Luminate tags.
In the unlikely event someone else encounters a similar issue I used postMessage() an HTML5 API to transfer my variable from the donation form back to the parent page.
https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
In the event anyone cares to read up on it. Let's you speak between iframe and parent page on the same domain OR on different domains. Depending on your use case it could be pretty useful, particularily with those who embed their participant centers into page builder pages.1 -
To set a session variable, you can append a query parameter like s_anyparameter=anyvalue to any Luminate Online URL. Luminate Online has a servlet called AjaxHelper which you can call with an AJAX request and append this query parameter, e.g. https://secure3.convio.net/shortname/site/AjaxHelper?s_foo=bar (where secure3.convio.net/shortname is your organization's secure path).
Alternatively, note that there is an API method called getTagInfo (http://open.convio.com/api/#content_api.gettaginfo_method.html) which evaluates Luminate Online template tags like S- or U-Tags. You can pass a U0 tag to this method and it will set a session variable.2 -
But is it possible to initialize a [[U0]] value with JS?
(now that I think about it, I'm guessing no, because the tags evaluate before the JS runs)0 -
Making an AJAX request to a URL like https://secure3.convio.net/shortname/site/AjaxHelper?s_foo=bar will have the same effect as [[U0:foo=bar]], e.g.
$.ajax({<br /><br/>url: 'AjaxHelper?s_foo=bar'<br /><br/>})
Alternatively, you can use the getTagInfo API method, like:$.ajax({<br /><br/>url: 'CRContentAPI',<br /><br/>type: 'POST',<br /><br/>data: 'v=1.0&api_key=my_key&response_format=json&method=getTagInfo&content=' + encodeURIComponent('[[U0:foo=bar]]')<br /><br/>})0
Categories
- All Categories
- 6 Blackbaud Community Help
- 213 bbcon®
- 1.4K Blackbaud Altru®
- 403 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.2K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 360 Blackbaud eTapestry®
- 2.6K Blackbaud Financial Edge NXT®
- 656 Blackbaud Grantmaking™
- 577 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 940 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.7K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 249 ResearchPoint™
- 119 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 241 Member Lounge (Just for Fun)
- 34 Blackbaud Community Challenges
- 37 PowerUp Challenges
- 3 (Open) PowerUp Challenge: Grid View Batch
- 3 (Closed) PowerUp Challenge: Chat for Blackbaud AI
- 3 (Closed) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 796 Community News
- 3K Jobs Board
- 54 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)

