Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Building a String

Avatar

Level 3

I'm using LCD (most recent version) and I'm having trouble building a string -- obvious newbie! :-)

I have a field called PrimaryEmailAddress where the user specifies their email address.

I have created a button, when clicked, will open a URL and pass the email address as a parameter.

Using Javascript, I though I could do the following:

var cTheEmail = PrimaryEmailAddress.rawValue

var cTheURL   = 'http://www.MyWebsite.com/MyUpload?email='+cTheEmail ;

app.launchURL(cTheURL);

Suffice it to say, but this does not work and I think it has something to do with how I'm filling cTheEmail variable.

What am I doing wrong?

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Your 1st message was in the public forum but its Ok I got the message removed before the file was available so no one could get it.....send it to livecycle8@gmail.com (only I have access to that)

Paul

View solution in original post

6 Replies

Avatar

Former Community Member

Seems to be working fine for me. Put an app.alert(cTheURL) before you launch the url and see if you get the right string. If that works, try hardcoding the URL in the launch command and see if it will launch for you.

Paul

Avatar

Level 3

var cTheEmail = ecPrimaryEmailAddress.rawValue;

var cToPass   = 'http://www.MyWebsite/MyUpload?email=' + cTheEmail ;

app.alert(cToPass);

If I execute the above, when I click the button, nothing comes up.

If I replace the cTheEmail Variable with the following: var cTheEmail = xfa.resolveNode("ecPrimaryEmailAddress");

then the following alert pops up,

http://www.MyWebsite/MyUpload?email=null

Note that I DO have a value in the primary email address.

Avatar

Former Community Member

That link goes to a dead link. Sounds like the object is not found. Rather than do a resolveNode get rid of that line altogether. Then add the line var cTheEmail = and leave your cursor there. Now hold the Ctrl key down and drag the mouse to the field you want to refernce. The cursor will change to a V symbol. Once it does that click the field and the reference to that field will be placed in the script editor at the last location of the cursor.Try it again.

If that does not work post your form and I will have  alook.

Paul

Avatar

Level 3

Still not working.

How can I post the form? Note that because the form is not offically released, it is still confidential. Can I email it to you?

BTW...really appreciate the help that you are offering here.

Avatar

Former Community Member

When you reply there is an attach files dialog in the reply area.

Paul

Avatar

Correct answer by
Former Community Member

Your 1st message was in the public forum but its Ok I got the message removed before the file was available so no one could get it.....send it to livecycle8@gmail.com (only I have access to that)

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----