If you are using relative urls to you resources you might have got the problem with dead images and resources that doesn’t load. The obvious choice is to add the full url to the images.
The problem is often related to when you autolaunch an XPage on database open.
But there is another way than adding the full url for the problem. You need to add a trailing slash to your path then everything will work as expected again. And using these few javascript lines added to your front page onload event or in a script on the page will fix the problem.
var h=window.location.href;
if(h.indexOf(".xsp")==-1){
if(h.substring(h.length,h.length−1)!="/"){
window.location.href+="/"
Check out my two post last year regarding a SSJS Debugger –> Link
Conditional breakpoints was one of the suggestions that was voted up as a function in the debugger and we get that. I don’t know if someone at IBM did read this and the feature is there because of the post but I like to think so 😉
If you have any great tip regarding debugging in Designer 9 please feel free to comment.
I had some feedback on the designer some weeks ago, that it would be good to filter away closed databases in package explorer. This does already exists in Designer today, Kudros to Dan O’Connor that showed me this. (The icon has changed from 8.5.3 to Designer 9)
And uncheck Closed projects
Now your package explorer is much cleaner and you can find you databases alot faster.
The closed project does also show up directly in the menu so you easily can toggle it.
You can also use worksets here to get better filtering of databases and on disk projects
People editing documents at the same time can be a big pain for the developer resulting in unwanted problems in an deployed application. To handle this problem I created a managed bean DocLock to handle the problem. The managed bean stores the username and an id each time the users edits a document. If another user tries to edit the document, you can block the user from entering edit mode.
To implement the managed bean in your own database is very simple, Copy the java class and add the managed bean setup into faces-config.xml ( check the supplied readme file)
The year started early with the release of Upgradepack 1 for domino.
We have got 3 fixpacks for domino and 6 releases of the extensionlibrary.
And so much knowledge published as blog posts/applications/custom controls/code snippets.
What a year!
I think that 2013 will bring alot of good stuff to. With the release of Domino 9.0 and hopefully Upgradepack 2.
If you ever tried to use a XPage dialog control from the extension library on a mobile device. You’ll probably seen this behavior, the dialog is moving away each time you try to click on a button or a field in the dialog.
The trick to fix this is to force the dialog to a fixed location if you are on a mobile device with a small screen.
There are several ways to detect this:
check out this stackoverflow question how to detect iphone by CSS –>Link
You can use this xSnippet –> Link or this post by Keith Strickland –> Link
When you can detect this and depending on your approach place the following code in a stylesheet
or if you place it directly as a computed style on the dialog.
The following css properties is that makes the dialog to stop moving around.
top:100px !important;
left:100px !important;
This will force the dialog to be placed at position 100,100 on screen. !important is a css property that forces an override of other properties set.
So what I usually do to fix this is add the xSnippet in a SSJS Scriptlibrary and add the following code as a computed style property on the dialog
When using custom controls there are several ways of binding fields to backend fields.
1. Create a datasource with the same name as the datasource you are using for the fields
(Warning! if you forgett to remove this when you are done you will get a replica conflict)
2. Pass the Datasource into the custom control and use the compositeData.propertyname[“fieldname”] to bind to the field. This article describes how to do this –>Link
3. Use a save function and retrieve the values from the fields and save the information to fields. This would also require a load function to populate the fields.
And there are probably several more ways of doing this, that is often the problem with XPages you get multiple ways of doing things and you don’t know the right way.
If often use number 1 when I’m creating xpages, the problem with this way is that if you have to add a new fields later you have to add the datasource again if you would like to use the simple binding dialog.
But there is another way, add a datasource with the variable name and properties as you main datasource. Go into source mode and add loaded=”false” to the data sources on you custom controls, you can still use the simple data binding and you will not get any replica save conflicts because this datasource isn’t loaded.
This is what you source should look:
Hope this will help you get rid of some annoying replica conflict when you have forgotten to remove a datasource. Enjoy!
I got an enhancement request from a user if it’s was possible to validate if the tinyMCE control had some text.
Because validation is implemented as a core property on XPage Controls this was a quick fix.
One Tip i can give when creating your own custom controls is when binding computed properties, set the property how the compositeData property should bind to compute at page load, if the data shouldn’t update.
Some properties of controls require this. I don’t know if this is a bug or if it’s this is meant to work like this. 😉
I also built an XPage using the Form Table control to display how the validation looks like.
There is alot of ways to validate fields. But if you ask me validating thru regular expression is very powerful because you can test for patterns in strings. You can test for valid email adresses, phone numbers or your required passwords.
Because regular expressions can be tested both on the client and the server using almost the same code you can do tests on the client side without doing round trips to the server when the user exits a field or perhaps while the user are typing.
Lets look at an example of an regexp
[a-z]+
This will check that the tested string contains letters in the interval a-z
(\d{5})
The above code will test so the string is five numbers.
This is very helpful because then you could test for a password pattern
((?=.*\d)(?=.*[a-z])(?=.*[A-Z]))
This will then test the string to contain a digit, a lowercase and an uppercase letter. Imagine testing this some other way, no thanks. To complete this we also need to test for length and that we do by adding this to the line .{8,14} this will test that the string is 8 to 14 letters long. So the complete string is then
((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,14})
This seams complicated you might say, Yes regexp can be complicated but then we have great resources online to just copy and paste regexp from. But test the regexp you copy from the web, they might not do what you want them to do 😉
The best regexp tester that I have found is Rubular
How to use Regexp with old school Domino and XPages
How do you use this in HCL Domino if you haven’t moved over to XPages yet, you could use this in client side javascript. And if you have moved over to XPages you can use this in Client side JS, Serverside JS and with a expression validator. I’m going to show you all these ways to validate.
1. Client side JS validation using RegExp
var field=document.getElementById("YOURFIELDNAME");
var data=field.value;
var re=/\d+/
if(re.test(data)){
alert("Valid");
}else{
alert("Not Valid");
}
2. Serverside javascript
The first Two lines changes from the client side script and also you need to write what should happen if the validation is true or not.
var inputText1= getComponent("inputText1");
var data=inputText1.getValueAsString()
var re=/\d+/
if(re.test(data)){
//do some stuff
}else{
//Do other stuff
}
3. validateExpression validator
The only thing diffrent in this validator than number 2 is that you return true or false when validation is done.
4. validateConstrain validator
This validator is used if you want to do a complete match of the value in the field using regular expression. My suggestion is that you start the string with ^( write you expression and end with )$ because then it’s easy to use a regexp tester when testing your regular expression this will tell the regexp engine that the string must validate as a line of text.
Update:
Check out this great post about how to create regex strings directly in the designer.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.