may be someone helps :)
I don't know much about Apache-Reverse-Server
I have a simple X-Page, see the code bellow.
If I open the xpage via
http: //domain1.de/e.nsf/test.xsp
and press the button, in log.nsf i see my print-out "Button is clicked"
If I open the xpage via
https: //example1.someproxy/rp/sproxy/http$domain1.de$80$/e.nsf/test.xsp
and press the button, in log.nsf i DON'T see my print-out "Button is clicked"
The Proxy-Server is installed and configured not by me.
<?xml version="1.0" encoding="UTF-8"?><xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:link escape="true" id="link1" disableTheme="true">
<xp:image id="image1" url="/btn.jpg"></xp:image>
<xp:eventHandler event="onclick" submit="true" refreshMode="complete" >
<xp:this.action><![CDATA[#{javascript:print("Button is clicked");}]]></xp:this.action>
</xp:eventHandler>
</xp:link>
What could be the problem, that the SSJS-code is not started via Reverse-Proxy at all?
Is reverse proxy the problem? Or is the problem that your code is not triggering?
I can't tell from your user id how experienced with XPages you are, but bear in mind a number of steps are performed on the server before it gets to your print statement. One of the key ones is conversion and validation. So if anything on your XPage throws a validation error, it won't run SSJS code.
Do you have a Display Errors control on the XPage and, more importantly, inside the refresh area? If not, add one. We've all spent hours in our early XPages life because validation or data conversion has failed and we didn't add anything to let us know. Once you get more confident, a PhaseListener is another useful tool for checking any or all lifecycle phases are running.
Related
UPDATED at bottom...
I have a custom control that contains an input field with typeAhead enabled:
<xp:inputText id="UTAN1" value="#{document1.UTAN}"
maxlength="5" styleClass="dbListFieldData" style="width:60px;font-size:13px;">
<xp:typeAhead mode="full" minChars="2">
<xp:this.valueList><![CDATA[#{javascript:var key = getComponent("UTAN1").getValue();
var path = new Array("","utans.nsf")
#Unique(#DbLookup(path,"(UTAN Lookup)",key,1,"[PARTIALMATCH]"));}]]></xp:this.valueList>
</xp:typeAhead>
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" refreshId="utanPanel1">
<xp:this.action>
<!-- DO SOME STUFF -->
</xp:this.action>
</xp:eventHandler>
</xp:inputText>
If I use the control inline on an xpage, typeAhead works fine.
However, if I insert the control in a dialog and call it to open:
<xp:link escape="true" id="link3" styleClass="dbListFieldData" >
<xp:eventHandler event="onclick" submit="false" id="eventHandler3">
<xp:this.script><![CDATA[XSP.openDialog('#{id:miniDialogUTAN1}');]]></xp:this.script>
</xp:eventHandler>
<xp:image id="image2" url="/edit2.png" style="height:16px;width:16px;" alt="Edit UTAN"></xp:image>
</xp:link>
The typeAhead seems to be partly crippled.
If the field is already empty, suggestions comes up fine.
If the field has an existing value, backspacing only shows the existing value as a suggestion.
Overwriting the value entirely gives no suggestions at all.
The only thing that will get the typeAhead working is to change the value and hit Enter. Basically, trigger an onChange. After that, ALL the typeAhead fields start working.
Any ideas on how to correct this behavior? FYI, I'm an xpages noob, so please go easy on me.
UPDATE 6/29/2021:
I'm still desperately in need of help with this. I've been playing around with Firebug and found something interesting.
In type-aheads on a normal Xpage form (where type-ahead works), entering each character calls a POST every time. However, when the type-ahead is in a dialog, typing in characters calls GETs. If I hit Enter or tab out of the field (triggering onChange), I get a single POST, and then clicking back into the field and typing, it starts using GETs again and it pulls valid suggestions as long as I don't backspace and type something different. Then the suggestions go away. This would be expected since GETs are cached and POSTs are not.
So what's going on with type-aheads in dialogs that makes them use GET, and how to I force it to use POST on every key press?
To people of the future...
After weeks of fretting over this and finally giving up I stumbled upon the solution by accident.
My dialog opens in read mode. I have both an Edit button and a Cancel button at top and bottom that were originally hard coded in both spots of the dialog custom control. Later I went to clean some stuff up and decided to create a single custom control for both sets of buttons. Once I did that, suddenly the type-aheads worked!
It turns out that when I copied and pasted the XML from the (supposedly) duplicate button panels to the new custom control, I had copied from the bottom button panel (which I rarely used while testing).
When I compared the XML for the top and bottom Edit Buttons, I found that the top one had the following attributes in the onClick:
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
while the bottom one had:
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="dialogOuterPanel1">
So, the full refresh broke my type-aheads and a partial refresh fixed them.
I have SSJS code behind a button. When i click the button that code creates a document in another database.
When i click the button It Works fine but I look at the Domino Admin COnsole I realize that The code behind to button Works twice.. I think When the page is refreshed It Works again? How can i prevent it?
What is it thet I miss?
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:print("Before createNewDoc()");
createNewDoc();
print("After createNewDoc()");
}]]></xp:this.action>
</xp:eventHandler></xp:button>
Add print statements to the beforePageLoad, afterPageLoad etc events to confirm where it is running. Also, it's worth using XPages OpenLog Logger or some other logging framework that can output a full stack trace. That might identify whether the code is running twice in the refresh, and where from.
There is no reason the code should be running twice from the button. I'm assuming this is an SSJS function in a Script Library, maybe something else is triggering that.
One of my XPages there are mo many design elements. The page takes time to load more than expected according to connection speed. I would like to create an indicator to show the logged user "The page is loading"... I made it for partial refresh and it works great but i couldn't make it for full refresh. I have been looking for a solution for this.
I can try jquery, dojo or ajax.
Any suggestion is important.
Regards
C.A.
I've not yet made a dedicated NotesIn9 show for it yet, but I do a demo of a technique in this TLCC webinar.
https://www.youtube.com/watch?v=jBaRSM9Ng_o&index=3&list=PL9nOJ-QrsuFa00dOsdE6EDh_l2fkiYD0D
The relevant part starts around the 26 minute part.
I'm doing this on loading the page initial but I'm sure could be adapted for a full refresh if you were already on the page.
The basic concept is on page load you don't actually load any long running data. You just sent the shell of the page and then in the onClientLoad event you trigger a partial refresh.
<xp:this.resources>
<xp:script src="/xpUtilities.jss" clientSide="false"></xp:script>
<xp:dojoModule name="extlib.dijit.ExtLib"></xp:dojoModule>
<xp:dojoModule name="extlib.dijit.Loading"></xp:dojoModule>
<xp:styleSheet href="/app.css"></xp:styleSheet>
</xp:this.resources>
Page 1
<xp:this.beforePageLoad><![CDATA[#{javascript:viewScope.put("vsHasData", false);}]]></xp:this.beforePageLoad>
- Header UI goes here....<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:panel id="MainContentWrapper">
<xp:panel id="MainContent">
<xp:this.rendered><![CDATA[#{javascript:return viewScope.get("vsHasData");}]]></xp:this.rendered>
<xp:br></xp:br>
<xp:repeat id="repeat1" rows="100" var="rowData"
indexVar="rowIdx">
<xp:this.value><![CDATA[#{javascript:viewScope.get("vsStateMap").keySet()}]]></xp:this.value>
<xp:text escape="true" id="computedField2"
value="#{rowData}">
</xp:text>
-
<xp:text escape="true" id="computedField3">
<xp:this.value><![CDATA[#{javascript:viewScope.get("vsStateMap").get(rowData)}]]></xp:this.value>
<xp:this.converter>
<xp:convertNumber type="number"
integerOnly="true">
</xp:convertNumber>
</xp:this.converter>
</xp:text>
<xp:br></xp:br>
</xp:repeat>
<xp:br></xp:br>
<xp:br></xp:br>
</xp:panel>
</xp:panel>
<xp:eventHandler event="onClientLoad" submit="true" refreshMode="partial" refreshId="MainContentWrapper">
<xp:this.action><![CDATA[#{javascript:return getStateTotals();}]]></xp:this.action>
<xp:this.onStart><![CDATA[XSP.startAjaxLoading("Calculating State Totals. This may take a few moments.")]]></xp:this.onStart>
<xp:this.onComplete><![CDATA[XSP.endAjaxLoading()]]></xp:this.onComplete>
<xp:this.onError><![CDATA[XSP.endAjaxLoading()]]></xp:this.onError>
</xp:eventHandler>
That's a demo page. The stuff to look at is for dojo resources that are added, the fact that I start off hiding the "MainContent" vie a scoped variable and then the end onClientLoad bit.
So the page loads, but the data to generate the repeat control does NOT run because it's in a non rendered panel. So the users get to the page instantly. Then the onClientLoad kicks - on Start it shows a "Please Wait" kind of thing then runs the function to get the data.
When the data is completed, I set a scopedVariable to then show the mainContent area and the endAjaxLoading stuff then triggers and everything gets displayed.
How you do this will not be XPages-specific. It's important to understand the order of events.
User clicks link somewhere to open page
Browser sends request to server
Server receives request and loads component tree for page server-side
Server runs beforePageLoad, afterPageLoad, beforeRenderResponse events
Server generates HTML to send to the browser
Server runs afterRenderResponse event
Server passes resulting HTML to the screen
Browser receives response from server
So adding anything to the XPage that is the target of the browser request at step 2 cannot have an effect. You need to do something client-side at step 1, before the request is sent to the browser. If you think about how you did it for the partial refresh and what's happening, again it's running CSJS before triggering the partial refresh, the same process.
If users are coming externally, the only option is to send them to a redirect web page first, render that, and continue programmatically running step 1.
I have the following test XPage.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:panel id="pagePanel">
<xp:text escape="true" id="didThePageCompile">
<xp:this.value><![CDATA[#{javascript:var d = new Date();
return d.toLocaleString();}]]></xp:this.value>
</xp:text>
<xp:br></xp:br>
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="dialog1"
onStart="XSP.openDialog('#{id:dialog1}')"
onComplete="XSP.closeDialog('#{id:dialog1}')">
<xp:this.action><![CDATA[#{javascript:var agent = database.getAgent("runLongTime");
var response = agent.run();
// var d = getComponent("dialog1");
// d.show();
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xe:dialog id="dialog1" title="Test Dialog">This is a test dialog</xe:dialog></xp:panel>
</xp:view>
The agent "runLongTime" just sleeps for 10 seconds. This works fine. When I click the button however the dialog box does not show up. I checked the source and it generates the correct code, and that code works when I manually put it into the console.
I don't get any errors and the agent executes fine. I've also tried changing the refreshId to "pagePanel", but still the same.
XSP.openDialog() and XSP.closeDialog() each trigger a partial refresh. The XPages client-side API includes logic for preventing multiple partial refresh operations from executing in parallel, which is likely preventing your dialog from displaying because by the time it attempts to run the refresh to show the dialog, it's already running your button event.
Add a JSON-RPC (called "Remote Services" in the control palette) to the page. Move your button's server event code to a method of the RPC. You can then change the button event to be purely client-side: call XSP.openDialog(), then call the RPC method and close the dialog in the onComplete of that method. This should prevent the race condition you're currently experiencing.
as far as I can see here, you are trying to open/close the same dialog.
Some days ago I got the same issue and wondered why this was not working.
Finally I checked the events and ended with the spectacular result that onStart and onComplete fired up almost parallel.
Maybe you could try to insert a timeout (window.timeout) before calling the XSP.closeDialog event.
I seem to be having an issue with the extensions library dialog box either not refreshing or caching values.
Please see the very simplified example below. Basically the button pops up an extension library dialog box. Contained in the dialog box is a computed field with #Unique() as it's value. On our prod server the number is not being updated when the button is pressed. It works on the first button press but subsequent presses do not update the number.
This occurs only in production and a similar issue has only started occurring in the past couple of weeks. It still works fine on our Dev and QA servers.
My admin contacts are out right now so I don't know the differences in versions between the servers but I will post them when I learn that information.
Here is the code:
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:this.resources>
<xp:script src="/Validation_SSJS.jss" clientSide="false"></xp:script>
</xp:this.resources>
<xp:br></xp:br>
<xp:br></xp:br>
<xe:dialog id="dlgMsg2" title="Message" style="width:400px;">
<xp:text escape="true" id="computedField1" value="#{javascript:return #Unique();}">
</xp:text>
</xe:dialog><xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:button value="Popup Message" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var dlg = getComponent("dlgMsg2");
dlg.show();}]]></xp:this.action>
</xp:eventHandler></xp:button>
</xp:view>
Update: The issue is occurring in both IE and Firefox so it does not appear to be browser related. I am guessing it is not Pistolstar related either as I had a previous issue with PS and Xpages. Pistolstar has discovered that issue and I will update my previous post when I get more details
Update: I checked and our QA and Prod servers are have version 8.5.3.20111208-0717 of the extension library.
I came up with a "workaround" to fix this issue. I added a refresh event handler for the onShow event of the dialog box.
<xe:dialog id="dlgMsg2" title="Message" style="width:400px;">
<xp:text escape="true" id="computedField1" value="#{javascript:return #Unique();}">
</xp:text>
<xp:eventHandler event="onShow" submit="true"
refreshMode="partial" refreshId="computedField1">
</xp:eventHandler></xe:dialog>
It would still be interesting to know the underlying issue.
In the All Properties section of the dialog there is a property called 'RefreshOnShow'.
When set to true the contents of the panel will be refreshed every time the panel goes from a hidden state to a visible state. This should resolve the issue that you are seeing.
It may be unlikely, but page persistence options in the xsp.properties could alter the way the page behaves across environments. There is the xsp.properties on the database and on the server. XPages Portable Command Guide has more details on the different settings, but settings could change what gets retained between requests.