PermaLink XPages sample application - download the Survey Tool demoed at Lotusphere 09 session AD20701/28/2009 07:55 AM
Domino 8.5 - XPages
In my Lotusphere session AD207, I presented an XPages built Survey Tool application.  Here was the abstract for the session:

Building an "XPages-Powered" IBM Lotus Domino Application
An unlimited number of editable documents on the same page? Generating the type of controls for fields on page load? Dynamic applications have always been a challenge for Lotus Domino development. Not anymore! In this session, you'll learn how to utilize the power of XPages to build a survey tool that can have an unlimited number of questions. We’ll show you how to dynamically allow for the selection of controls on the page load, such as checkboxes, radio buttons, and combo boxes, etc. Go under the hood and see how we use multiple data sources per page and some powerful XPage controls to build this application with a minimum amount of coding.

The goals that I set out to accomplish in this session were:
  • To select an application that could not easily be built with the standard Domino Designer..... demonstrating the power of XPages.
  • Secondly my goal was to utilize XPage controls to build a complex application with a minimum amount of code or workarounds.  
    - Thinking “Inside the Box”....

Thinking "Inside the Box" ???  Yes, you are right, I am the first person on the planet to coin that phrase...  It was a little tongue-in-cheek humor but the point is, when was the last time you used only the tools provided for you in the domino designer to build a web application?  Probably 1998 when we all built the view with the left hand navigator.  So I wanted to show how you can build a complex application with just the tools provided in the box and with very minimal code.

An underlying key difference between standard Domino development and XPages is the separation between the presentation and the data store. This change allows a developer to build applications they could not easily build previously, and also approach application design from a different angle.  By taking advantage of this change and utilizing the built in XPage controls that exploit this separation, you can build sophisticated applications that were extremely difficult in the past.

The reason I chose a Survey tool was that a Survey Tool provides many challenges for Domino Designer:
  • It must allow an administrator to create an unlimited number of questions
  • Allow the Admin to change the order of the questions
  • Select the type of input control to display: check box, radio buttons, text box, drop down list etc.,. and render them dynamically
  • Provide dynamic validation
  • Provide dynamic navigation: one question per page, all per page
  • Report on the data

You can download my presentation, which covers the design details, here: Lotusphere 2009 presentation - AD207

You can download the SurveyTool.nsf application here (requires registration): Lotusphere 2009 sample application - SurveyTool.nsf (* see notes below)

Here's a couple of screen shots:

- Administering questions for a survey.  Note that multiple questions can actually be edited at the same time because they are independent docs:
Image:John's Blog - XPages sample application - download the Survey Tool demoed at Lotusphere 09 session AD207

- editing questions by clicking on the individual edit links:
Image:John's Blog - XPages sample application - download the Survey Tool demoed at Lotusphere 09 session AD207

- Taking a survey showing all questions on a single page:
Image:John's Blog - XPages sample application - download the Survey Tool demoed at Lotusphere 09 session AD207

- The same survey except configured to show only one question per page:
Image:John's Blog - XPages sample application - download the Survey Tool demoed at Lotusphere 09 session AD207

- Reporting on the survey by using the dojo toolbox provided with Domino 8.5:
Image:John's Blog - XPages sample application - download the Survey Tool demoed at Lotusphere 09 session AD207

This application is not 100% complete, for example access control needs to be worked out, but it's a great example app to learn some advanced XPage techniques from.  

I hope you enjoy it as much as I did presenting it....

John

* If you are installing the application on a server, remember to sign the database with your id.  Also make sure that your server document has the XPages security set properly.  Here's a link for details on setting the security: http://www-10.lotus.com/ldd/nd85forum.nsf/5f27803bba85d8e285256bf10054620d/d9851c77bf81402d852574b8005e236d?OpenDocument

** There is a bug identified with the tabbed panel control.  IBM has opened up an SPR. Here is the scenario: If you enter some data on tab 1, then go to another tab and save, the data on the first tab is lost.  If you enter data on tab 1, go to another tab and then go back to tab 1 at least 1 time during your session...the data will be saved.  


Technorati:
This page has been accessed 5017 times. .
Comments :v

1. John Turnbow01/28/2009 06:55:17 PM
Homepage: http://www.recondite2.com


Hi John,

Thanks for your hard work. I have not received an email though.. Just checking..

Thanks




2. John Mackey01/28/2009 07:55:13 PM
Homepage: http://www.jmackey.net


@John. I sent you an email directly with the url. Not sure if there is an issue with the registration routine or not. If anyone else experiences an issue, please post a comment. Thanks!

John




3. Matthias01/29/2009 02:53:42 AM


John,
nice application. Registering is working and i got a link.
I have one little problem when creating a new survey. I cannot add new questions to it. Even when I save nothing is saved and i see the predefined surveys and not mine.
Did i miss something here?




4. John Mackey01/29/2009 03:24:32 AM


@Matthias, try just entering the survey info on the first tab and then save/exit and it should work.

There seems to be an issue when saving after you navigated to a different tab. I have to identify the sequence, but the save buttons perform a "save all data sources" so it should not matter that you are on a different tab.

Let me know if that works for you...

John




5. Matthias01/29/2009 04:15:03 AM


@John, yes that works. Thanks




6. John Mackey01/31/2009 09:00:14 AM


@All, I found an XPages bug that Matthias pointed out. It seems that when a save occurs from an action within a tabbed panel, none of the fields in the other tabs are saved even though they share the same datasource. If the action button is placed outside of the tabbed panel, the data is saved from all of the tabs.

In the Survey Tool example, the "Add New Question" button on the Questions tab performs a document.save() which ends up discarding the first tabs data.

I posted the issue on the design partner forum. So for now until I have a resolution, just save any changes before adding questions by using the Save button on the top of the page.

John




7. Patrick Kwinten02/01/2009 11:41:43 AM
Homepage: http://quintessens.wordpress.com


I heard positive remarks from people who visited this presentation @Lotusphere.

Would be great if someone picked up this work and transfer it as a project on OpenNTF




8. Darin Dutcher02/05/2009 02:46:57 PM


Hi John. I am getting a runtimee error on pages that access your .jss file. I have signed the DB. Do I have to set some security in the server doc? The homepage works, but not the others. Thanks, Darin

The runtime has encountered an unexpected error.
Error source
Page Name:/Survey.xsp
Control Id: RptQuestions
Property: value

Exception
Error while executing JavaScript computed expression
Error while reading library '/SurveyFunctions.jss'
Error while parsing JavaScript code




9. Iftakhar Rasul02/20/2009 08:02:53 AM


hi John,

I couldn't preview it on the web. All I see is this -> '/'. Any idea?

regards,
Iftakhar




10. Daniel03/09/2009 06:33:15 AM


Hello John,
great work, i used your application to get into the "XPages thing". Thank you for that.

One Question: Do you think it is possible to save all the qestion data into one notes document instead of saving them into seperate documents? I tried to play with the simple data binding but i am not able to compute values there, with java script i was only able to display values, but not to entere values.

Thank you again,
Daniel




11. Renato03/11/2009 03:17:27 AM


John,
Very nice application.
I am getting this error on Survey Xpage:
The unknown tag xc:SurveyNavigator cannot be used as a control. - Survey.xsp - SurveyTool.nsf/XPages line 7 -
Can you help me?
Thanks




12. John Mackey03/17/2009 07:32:18 AM
Homepage: http://www.jmackey.net


@11, yes I duplicated this issue. Weird... Can you post it in the 8.5 forum and see if we can get an IBMer to look at it? { Link }

@10, I responded via email but wanted to post for others. Storing all the questions on a single document goes against the benefit of XPages and the separation of presentation from the data. You will also be challenged when you try to report on the data. Now with that said... it might be possible to dynamically generate the fields in the data binding using: Advanced - Expression Language(EL). All the other choices such as computing the field name, will only provide readonly access.

Here's a link to the EL documentation - { Link }




13. Joe03/31/2009 12:50:25 PM


John,
Great work. Doesn't work with IE8:

Webpage error details


Message: Member not found.

Line: 20
Char: 49436
Code: 0
URI: /domjs/dojo-1.1.1/dojo/dojo.js




14. John Mackey04/02/2009 04:37:55 AM
Homepage: http://www.jmackey.net


@Joe, I looked into this and see that IE8 is not currently supported. Here's a post from IBM on the issue: { Link }

-John




15. aymen04/08/2009 07:13:20 AM


Great work thanks a lot




16. Edwin05/25/2009 02:14:34 AM


Hi John

Great work, may I know if it's possible to starting using add new question in survey questions tab before saving the document first? seems the add new question button create nothing without being saved document.

Thanks & Regards
Edwin




17. Shyam06/08/2009 12:48:25 PM


Hi John,

Thanks a lot for the excellent article/tool.

I am somehow unable to "send out the survey".. Sent the survey to my own id.. The recipient tab does indicate that the survey was sent to my id, but have not received any mail so far..

Any idea what i may be missing here ?




18. John Mackey06/08/2009 01:03:11 PM
Homepage: http://www.jmackey.net


@Shyam, the "SendEmailInQueue" agent is disabled in the example by default. Once you enable it, it should send the emails (after you sign it of course). Take a look at the "vwEmailsToBeSent" and the email should be queued up to go.




19. David Clover10/16/2009 05:48:10 AM
Homepage: http://mct.open.ac.uk/it-dev-blog.nsf


Very neat and useful to study! However, every time I try to complete a test survey I get the message: Validation Error: Value is required.

Is that because it's only a test system in itself? I can see it working OK on the browser and the entries i have made are all coming up just fine!

But we can reverse engineer this a bit I expect.

David Clover
IT Development Manager
Maths, Computing and Technology Faculty
The Open University
Milton Keynes
MK7 6AA

Tel: 01908 653529
{ Link }




20. Roland Jaeggi11/26/2009 11:59:53 PM
Homepage: http://www.advances.ch


Hi John,
I tested your application which is very usefull. Do you know when dojo.js 1.3 will be available ? I did not found the answer.
Would it be easy to modify the application in order to make it non anonymous, in order to see who has answered and who not.
The "SendEmailInQueue" agent does not work properly, he sends only one mail at a time.
Thanks for your posting




Search
Partner with us
Need help on your XPages projects?

Talk to the experts! Read more...
XPage Examples
By Category
About Me
Downloads
My Links
Monthly Archive
Powered by
Blogsphere
Lotus Domino ND7 RSS News Feed RSS Comments Feed Geo URL netcraft RSS Validator Lotus Geek Chris. A. Brandlehner OpenNTF BlogSphere