How to call af:popup from another page? - jsf

I have used af:popup a lot in my application and I call the popup only from the pages in which it is created. For example, if popup1 is created in Page1, I can call it only from this page!
I want to call a popup being created within Page1 from Page2. The real scenario is that I want to create the popup within the pageTemplate, and use it everywhere.
The problem with this is that it does not recognize the bindings that are used in the popup when called from another page. Does anyone know how to fix or avoid this?
Please tell me what approach have you used in this case?
Thanks

Actually 1 Page Definition (Binding Container) per page is not a hard/fixed restriction. You can use the same PageDef for more than one page. Admittedly unusual but works. Go to the Databindings.cpx file. You will notice that the jspx page is associated with its pagedef file, not by tightly coupled/direct reference, but by an indirect UsageID. Edit the metadata to have page1 and page2 use the same page definition file, via the usageID. Then the binding container will be shared by both pages.
BUT, PageTemplates can have their own page bindings - have you tried this?

If the problem you're having is the popup when used on Page2 isn't recognizing the bindings from Page1 it's because you don't have those bindings on Page2. Check your Page2 bindings, and ensure you've got the same ones (need to be named the same as well). You will need to add them if they aren't there! Each page has its own set of bindings.
I hope this helps.

Related

Accessing properties across pages in AEM HTL (Sightly)

I have a carousel component, whose slide content will be the content from another page, accessed via reference component. I want to get some properties authored in the carousel to be accessible inside the referenced page. i.e. I have Page A- with a Carousel accessing PageB through reference component. I want to get proeprties from PageA in PageB. Can this be achieved?
Sure it can, you will need to lookup/query the content and find pages where PageB is included, then get the properties of those pages (there might be more than one) and merge them. It will have to be custom code though as this is not available out-of-the-box as of AEM 6.3.
The solution could be adding a query parameter or setting a request parameter. But then again, this depends on the requirement. For me, this worked!!

Use a content script to create an element on the page that is invisible to the page

I have a content script in a Chrome extension. I'd like to inject an element into the page, but I need to do so in such a way that the page is unaware of the injected element at all, i.e. it needs to be completely invisible to the page and only visible within the content script context. The page should not be able to locate the element (even with getElementByID), receive events related to it, or anything.
Is such a thing possible? How would I go about doing that? If it's not, what is the closest thing I can do?
If Shadow DOM as mentioned by #Xan doesn't work for you:
The next best thing would depend a lot on what you are trying to do.
A browser action might suit your needs as you could put the data/buttons/etc. you want to display there and the page would not be able to get to it. You could still run a content script to get the data needed from the page.

Xpages Extension Library - pageTreeNode or basicLeafNode

With a pageTreeNode I can forward the user to another page in my application, but I cannot take any action beside this.
If I want to do some more actions, I have to use a basicLeafNode and in the action I use (for example):
viewStateBean.restoreState = true;
context.redirectToPage( "someXPage.xsp" );
Is the behavior really the same, or what is recommended to use ?
following explanation I found on http://michelles-universe.blogspot.de/
hope that helps you
xe:basicLeafNode -- Use this to link to any standard URL. You can hard-code or compute the href and label properties. This can be used for links to standard Domino forms or pages, or any other general type of link. For links to another xPage, use the pageTreeNode instead
xe:pageTreeNode -- use this if you want to point to another xPage. All you need to enter is the page name in its simplest form (e.g. demo.xsp) and the text you want displayed. There is no need to compute the entire URL - that's all done for you

Run a javascript function on click of popup icon of chrome extension

As chrome.browserAction.onClicked works only if there is no popup, is there any alternative method to fire a query when browser action icon is clicked?
Let me make myself clear..
I have more than one view i.e, html files in my extension. My default popup in index.html
Whenever I click on the icon I want to fetch some data from server. If I include this function in index.html or index.js, this function gets called every time I go to that page. Can anyone help me?
Thank you in advance.
What I would do is:
Have the behavior take place in the onload handler of the page. Since it sounds like the default popup page, index.html, can be loaded as time when the user is not creating the initial popup, I would create a page that is a dedicated initial popup load page that is not used anywhere else. This page could redirect to index.html or include it as an iframe.
Another option is to have index.html take a query string indicating how it is being used. Your initial popup could be index.html?init=1 and all other inclusions of the page simply use index.html. Then use window.location.search.substring(1) to test if a query string is present and take the appropriate action.
I'm also looking for an solution to this and I'm wondering if it is possible to start the browser action with no popup, detect the click, then set a popup with "setPopup()". If it works it doesn't seem like the nicest approach, I hope someone knows of a better solution.

In XPages Mobile App / Mobile Control, how to make picklist

I have two pages, one page for input, another page for the options, how to send value form page to another page on xPages Mobile Controls, or is there another way to make like this.
See my sample page:
1. Page 1:User Input
http://i1248.photobucket.com/albums/hh490/dannysumarnach/page_1_form_user_input.jpg
Page 2:Picklist
http://i1248.photobucket.com/albums/hh490/dannysumarnach/page_2_user_choice_PickList.jpg
note: the built-in typeahead not posible
Regards,
Danny
The in built type ahead is missing the dojo tundra.css file when using the single page app control. This file comes with Dojo its just not being included. Import this file to get the type ahead to work.
I'm unsure as to what you mean about passing value from one page to another, you can submit data to a document and open it in another page, add it to a scoped variable, add a parameter to the URL. All of these options will work.
Have a look at my blog post on this topic. There are a couple of gotchas to get around, most notably, ensuring the the page with your document datasource gets recalculated at the correct time. I'm working on a NotesIn9 on it.
Part 3 covers a couple of amendments to get it working with existing documents and includes a sample page that will work in the Extension Library Demo db. Note the extra view that needs to be created and other details in Part Two.
http://www.intec.co.uk/xpages-mobile-controls-and-value-pickers-part-three-client-side-approach-extended/

Resources