Oct 15

One cause for XPage error “The form does not contain an input: $$viewid”

I got an interesting error today: “The form does not contain an input: $$viewid” after clicking a button which does a partial update. To be exact: the partial update worked once, but on a second click that error occurred:

screenie

Fore sure, the hidden input field $$viewid was present in the HTML. I found the cause after removing code block after code block in the XPage and it’s custom controls: a simple table tag was not closed.

I cannot explain why a missing HTML tag can cause this kind of error… but don’t see the point in investigating further since I’d like to move forward with my business logic instead of chasing weird errors.

So, if you ever get this error: check your HTML carefully.

 


Oct 14

XPages in Notes Client (XPiNC) – why still Error 500? And a solution of some kind.

I want to develop some additional features to existing Notes applications for a customer. The nature of the features makes it necessary to use XPages.

Using XPages side by side with classic Notes using Composite Applications seems to work now (9.0.1). There are still some weird caching issues and sometimes I need to recreate a Composite Application to get rid of them, but once the CA works, it seems to be reliable.

But quite often when trying to view an XPage in the client I get this:

screenie

I guess everyone developing XPages for the Notes client knows this error very well. For me, I can reproduce it as follows:

  • open XPage (even the most simple one) in Designer
  • make some change, for example, at a space somehwere and save
  • preview the XPage in Notes
  • you will see Error 500

Then, when I close the Error 500 page in Notes and preview the XPage again (without making another change) the XPage works fine.

I could live with that. But: other Notes clients get the Error 500 page most of the times, too, especially when the XPage is used in a Composite Application.

Here is what I do not understand: XPages in Notes are around since 8.5.3 at least. That means: FOR  FOUR YEARS!

FOUR YEARS! FOUR YEARS! FOUR YEARS! 

Why do we still get these kind of errors? 

I really don’t get it. I do nothing fancy. I just want to use a supported and documented feature, and that is: using XPages in Notes in a reliable manner. And what do I get? Error 500 without any useful information. Even with the most basic XPage.

Ok, getting upset does not solve the issue. So I tried to get some kind of workaround. And I found that after adding the NSF to Notes Preferences -> XPages Performance -> Preload XPages in the following appliations the XPages seems to work more reliable:

screenie

That means: the XPages work in Notes as long as I don’t make any change in Designer. After making a change, the Error 500 comes back until I preview the XPage a second time.

Is this a solution for my customer? How does this scale with let’s say 10 NSFs, each having various XPages with lots of Custom Controls? I don’t know. Yet.

All I know is that I really WANT to use XPages in Notes. And I’m very unsatisfied that I still have to fight these kind of basic issues.

 


Oct 12

Looking for a new home for xpageswiki.com

As you might have noticed, xpageswiki.com is down. That’s because the Domino server it was hosted on was taken down, and I don’t have a public Domino of my own.

So I’m looking for a public Domino where I can host the xpageswiki.com database. Anyone interested? I would make a acknowledgement on the xpageswiki.com homepage 🙂

Update: seems to be solved, I got several offers!


Sep 01

underscore JavaScript Library für XPages ServerSide JavaScript (SSJS)

If you’re building web or mobile apps, most probably you know the underscore library from underscorejs.org. If not, you should have a look at it. It contains a lot of useful basic functions that eases developer’s daily work a lot.

Today I had to implement some fancy stuff regarding JavaScript arrays in XPages ServerSide JavaScript (SSJS). And I really missed my beloved underscore library…. so I had a look at the source and tried to use it as library in SSJS.

For sure, it didn’t work right out of the box. There were several issues because SSJS is no real JavaScript… but anyway, I managed to workaround most issues and now it seems to work.

If you’re interested, download this source: jbuss_underscore. Have a look at the notes at the beginning, it listens some underscore functions that cannot work in SSJS.

There is a good chance that some functions doesn’t work yet, if so, leave a comment at this post and I will try to fix it.

If you’re curious: look for “!! jbuss” markers in the code, these are the pieces I needed to change.


Dec 10

XPages HTML5 MultiFile Upload With Drag and Drop

Year ago I published a HTML5 Multi File Upload Control on openntf, now I extended it with drag & drop capability. And after doing some research, it was suprisingly easy.

First you need the custom control, download it here from openntf.

Then you need to add a div as target for dropping files:

Drop files here

Add some CSS to make the div pretty.

Finally you need to add this CSJS to the end of the custom control:




In the drop event we get the list of files dropped onto the div from the dataTransfer object, and we can put this list of file objects to the ynUploader_worker function which is already defined in the custom control.

I tested this in Chrome, Firefox and IE11 and – what a pleasant suprise – it works in all of them, even in IE.


Dec 03

Fulltext index “immediate” does not work with XPages in the web?

I just found that on a Domino 9.01 server the Update.FulltextList queue does not change when I add a document to a NSF via XPages in the web. The fulltext update frequency on that NSF is set to “immediate”, and the result is that the fulltext index is never updated automatically when there were changes to documents via XPages/Web.

After I made some change via Notes the updater runs after some seconds and the ft index is being updated just fine.

I’m aware that I can create a program document with “updall -F <path to nsf>” and schedule it to run every five minutes, but that leads to “index is already in use” messages sometimes when a XPage wants to use the ft index.

I’m puzzled. Is this behaviour intended? Am I the only one in the world who came across this problem? Does nobody else is using fulltext search in XPages?

I added a question to stackoverflow, too. If you have an idea, you can respond there, too.

 Update:

I was wrong. It DOES work. It just looked like it didn’t work, because it takes up to 15 minutes until the ft index gets updated, and the Update.FulltextList statistic seems to lag behind the current situation a lot.

So although the update task on that server has nearly no load at all, “immediate” updates takes up to 15 minutes. UPDATE_FULLTEXT_THREAD=1 and FTG_USE_SYS_MEMORY=1 are set in the notes.ini.

There has to be a way to speed this up. But how?

 


Nov 18

Using Mozilla’s JavaScript PDF Viewer in XPages

I’m doing a lot of mobile stuff these days, but XPages is another big part of my work and this will not change in the foreseeable future. One project I’m working on is a tool to put iNotes mails into an archive system.

While doing that, the user should be able to view attachments a mail might have – including PDFs. View means viewing in the browser, not downloading the file to the computer. But exactly this happens when you open a typical Domino URL like /db.nsf/0/<UNID>/$FILE/filename.pdf.

You can display images inline using the embed tag. That’s very simple. But that does not work for PDFs. So what now?

Lucklily, there are various JavaScript based PDF viewers out there. I tried Mozilla’s PDF.js and found it very easy to integrate:

  • Download the stable version from http://mozilla.github.io/pdf.js/getting_started/#download
  • Extract the archive to some folder. In Designer, open the Navigator view, navigate to the WebContent folder, rightlick and select ‘import’, then import the folders ‘web’ and ‘build’ into the NSF.
  • Now you can call the PDF viewer with an URL like this: http://host/db.nsf/web/viewer.html?Open&file=/db.nsf/0/<UNID>/$FILE/file.pdf

It’s impressive what’s possible with JavaScript, isn’t it?


Sep 30

Use flowchart.js and raphael.js in XPages – problem and solution

I came across a weird problem today. The task was to use flowchart.js in an XPage to create a flowchart like this:

screenie

So I downloaded flowchart.js, added it to the WebContent folder of the NSF and included it to the XPage using this code:


 

Since flowchart.js is using raphael.js I did the same with Raphaël’s library. Pretty straigtforward, isn’t it?

Unfortunately, it simply didn’t work. Chrome’s console simply told me something about “Raphael is not defined”. So there was some problem with loading the raphael.js, obviously.

First I thought about a charset problem. raphael.js is using some special chars, but the file I downloaded was coded in UTF-8, so it should be fine. On the other hand, when opening raphael.js from the NSF with an URL like “http://host/path/db.nsf/rapahel.js”, Chrome told me it’s in a Windows codepage and there were lots of weird characters.

So I did various tests to investigate further, but to no end. Wether I saved the raphael.js file in Mac or Windows, stored it in WebContent or as file resource or in Domino’s HTML folder, the problem remained.

The customer for which I’m working at the moment found something about the “Raphael is not defined” message at stackoverflow, and the cure should be to use AMD module loading. Due to the charset weirdness I didn’t thought about that proposal very much and continued with the charset investigation… but in the end, I was wrong.

Indeed, raphael.js seems to have problems when loaded after other JavaScript libraries. The following code was suggested at the raphael site:

define([ "path/to/raphael" ], function( Raphael ) {
  console.log( Raphael );
});

Unfortunately, that does not work in XPages wit Dojo. But this combination of traditional loading and Dojo’s AMD loader works for me:


	 
		
		
		 
	

and in the body of the XPage:


After the require the Raphael object exists just fine and can be used by flowchart.js.

I admit that I don’t fully understand what’s going on, since I didn’t used Dojo’s AMD loading much yet. Perhaps someone can shed some more light on this topic 🙂