This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Sep 10, 2012, 2:20 PM
37 Posts
topic has been resolvedResolved

Can a BasicLeafNode have a "target"?

  • Category: Extension Library
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 8
 Hello, all!
 
   First of all, I'm somewhat slow in picking up XPages, and still find it easier to build web apps in traditional Notes/Domino.  With XPages, the Extension Library helps, so, I guess I'll keep plugging along until I can get it.  =8P
 
   In traditional Domino, you could build a link, and select a target for "_blank" or "_new", if you wanted, so that a URL that left your site would open in a new browser window.  I'm adding a link in the BannerUtilityLinks, in a BasicLeafNode, and there's no notion of "target".  When I view the source of the resulting web page, I can see the "a" tag, but I get an error trying to add the "target" in the XPages source.
 
   This was a very, very basic thing in traditional Notes, so I must be missing something in XPages.  I'm sure it's something very simple somewhere, but I can't seem to find it.  Someone else asked here in April, and someone asked on OpenNTF, as well, with no response. 
 
Any help would be greatly appreciated. 
 
Thanks, in advance! 
 
Steve in NYC 
 
"It hurts to be on the cutting edge." 
Sep 10, 2012, 3:23 PM
366 Posts
Re: Can a BasicLeafNode have a "target"?
 Instead of using the href use the nodes onclick event and add the CSJS to do a window.open("url","target")
 
 
Sep 10, 2012, 5:24 PM
37 Posts
Re: Can a BasicLeafNode have a "target"?
 Thanks!
 
   I'm using SSJS to look up the URL, so it seems I can't use the window.open method or CSJS.  I suppose I can hide the value somewhere on the XPage, and refer to it in CSJS.  Isn't there a simpler way?
 
Steve in NYC 
Sep 10, 2012, 6:15 PM
366 Posts
Re: Can a BasicLeafNode have a "target"?
 You can either use ajax to run SSJS from your CSJS or use the following code to execute CSJS from the end of your SSJS logic
 

var scriptCode = "alert('Submit Button - Full Refresh Click Event')"

view.postScript(scriptCode);  
Sep 10, 2012, 6:49 PM
37 Posts
Re: Can a BasicLeafNode have a "target"?
 Thanks!
 
   I tried it, but it didn't work.  Instead, I included a "javascript:window.open" in the href, once I calculated the URL.  It mostly works, except, the original XPage only has the word "[object]" on it once the proper URL opens in a new window.  I'm sure there's a "return false" that needs to be there, though, I'm not sure where.  I'll keep plugging away.
 
   Here is the bit of code for the utility link: 
 
<xe:basicLeafNode label="Help">
<xe:this.href><![CDATA[#{javascript:var ndProf = database.getProfileDocument("F_Prof",null);
var url = ndProf.getItemValue("Prof_HelpURL")[0];
"javascript:window.open('" + url + "', '_blank');"}]]></xe:this.href>
</xe:basicLeafNode>
 
Thanks! 
 
Steve in NYC 
 
P.S. I saw an article you wrote about an alternative to profile documents, due to some caching issues.  I still use the profile documents for values that can change, but don't change very often, such as this link to the "Help" information.  :-) 
Sep 11, 2012, 1:09 AM
586 Posts
Re: Can a BasicLeafNode have a "target"?
 Steve,
 
 
I'm guessing it's not built in simply because it's oneUI and they probably expect you to stay in that framework.  I'm sure it can be done...  hmmm
Sep 11, 2012, 6:29 PM
37 Posts
Re: Can a BasicLeafNode have a "target"?
 Thanks!
 
   I've put it aside, for now, and moved on to other things.  Frustrating, but still...  I'm somewhat new to XPages, but I've been building mostly web based Notes apps since 4.6.  Once CSS came out, I was on top of it.  Once javascript, then jQuery came out, I used those, too, to build "web 2.0" applications without the "bells & whistles" that XPages have.  As such, I'm not super "wowed" like a lot of programmers are with XPages, but I'll keep plugging away.  I can hear Yoda speaking to me now "You must unlearn what you have learned...".
   It's been frustrating with some of the easier ways in traditional Notes/Domino, but once I heard about the "XMage" title,  I became much more motivated to learn it.
 
   The CheatSheet and NotesIn9 stuff you're doing is helping a lot, too, so many thanks! 
 
Steve in NYC 
 
"It hurts to be on the cutting edge." 
Sep 11, 2012, 8:37 PM
366 Posts
Re: Can a BasicLeafNode have a "target"?
 I'm assuming you have to run the SSJS to get the url. 
 
The following is a little kludgy but it's consistent and works. 
 
The code uses ajax to call a domino agent or xagent that returns the url value and then prompts the user that they are being redirected. 
 
without the alert it returns undefined everytime so there are some timing issues.  I tried sleeping the process but that didn't fix it. 
 
Will keep this in my "unrsolved" pile  
 
working code 
 
 

        // Return the target node on the page where the results will be displayed

        var targetNode = XSP.getElementById("#{id:displayResults}");

var db = "#{javascript:database.getFileName()}";

        // The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.

        var turl;

        var xhrArgs = {

            url: "/" + db + "/DojoQueryXagent.xsp",

            handleAs: "text",

            load: function(data) {

        turl = data;

                targetNode.innerHTML = data;

            },

            error: function(error) {

                targetNode.innerHTML = "An unexpected error occurred: " + error;

            }

        }


        // Call the asynchronous xhrGet

        var deferred = dojo.xhrGet(xhrArgs);

        XSP.alert("You are being redirected to NetNotes")


        window.open(turl, "_blank");   
Apr 10, 2013, 6:02 PM
37 Posts
Re: Can a BasicLeafNode have a "target"?
 Hello!

   I thought I had closed this one off, but since I'm close to finishing this project, I came back to this issue.  Here's what I did, now that I know a lot more about XPages since I asked the original question: 

  I created a hidden input, which gets the URL from the profile document.  Then, just got a handle of the ID, and voilà! 
 

var vID = '#{id:hdnHelpURL}'; 
var url = dojo.byId(vID).value;
window.open(url, '_blank'); 

Thanks! 

Steve in NYC 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal