Category Archives: Posts - Page 16

Using RegExp to make field validation easier

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.

http://www.intec.co.uk/test-your-regular-expressions-in-domino-designer/#comment-1498

Domino Designer Memory Configurator is here

Do you want more speed in Domino Designer?

Do you want to configure you designer memory but always forget where to do it?

Did you know that everytime you add a Fixpack of the designer the memory is reseted ?

Now this is no problem just use Designer Memory configurator and with 2 click your memory is increased to the level you need.  

Download it using the link below

–>>> Designer Memory Configurator

If you every used .copytodatabase with a replicated or clustered Domino

I had a strange problem with documents that disappears in a replicated or clustered environment.

A more deep investigation lead to the discovery of deletion stubbs being created days/weeks/months before the document even was created, Strange. Documents getting create date the same as the original document.

But then a discovery was made .copytodatabase creates the same UNID everytime if the original document isn’t in the database. OK who cares the document isn’t in the database and no other document has that UNID. So far so good, but if you copy the document delete the new document in the new database. And copy it again, it gets the same UNID anyway. OK you might say, do this matter.

YES

It’s overwriting the deletion stubb on the destination database. If this database is in a clustered or replicated environment this will give your very very strange results. Documents disappearing, One minute they are there the next the documents are gone. 

There is a notes.ini param that fixes the problem, but there is nothing in the documentation. And do we need a notes.ini to fix a bug? It should be the other way around if you built an application that uses a functionality based on a bug then you should need to apply the notes.ini param not the other way around. 

To fix the problem apply the notes.ini param where your code runs client/server and you need to restart after applying.

CopyToDatabase_New_UNID=1

There is some other workarounds, one is creating a new document and using copyallitems. And the other one is copying the document two times but both these workarounds will give you problems if your document is large. So I would recommend the notes.ini param. 

This problem should only affect LotusScipt code but after trying it out it works the same in XPages also.

Notes Client as a browser plugin

After reading the post by Raj –>link about the Notes browser plugin in 8.5.4

This is great the Notes client as a browser plugin, all you old applications running in “browser notes”

Hopefully an automated install can be preformed so the user interaction is minimized to UserName and password, in the comment Raj writes that server name also needs to be specified. Hopefully this can be removed with some  install param. Or that you could get this from the server you download from.
Perhaps require a login on a Domino server thru http, then you know the username, password and homeserver directly. 

According to the blog post the install is 60MB and under one minute in install time.

I just want to say Woow this is real news for the corporate use of Lotus Notes.

Even if it’s an ordinary notes client behind the scen, it’s what the user sees that matters.

Good work IBM 

Ed Brill post about the Lotus Notes Browser Plugin

Some minor updates to SmallTalk and TinyMce editor

I have today released some small updates to SmallTalk and the tinyMce editor custom control.

SmallTalk needed some polishing to the attachment upload working in the client.

And for the tinyMce control I did some changes in the init scripts because they gave some strange js
errors in older internet explorer browsers so now it should work in IE7 also.

Enjoy 

Let’s do a Social Group Activity and what a response

Woow what a response. I sent out last night on twitter that we should start a social group activity.

The idea didn’t start last night you might remember that I wrote about that Lotus Notes and XPages needs a great tagline, Post 1 Post 2. The Lotus Notes community needs something to get together around.

If you use Lotus Notes for email or traveler for email in you phone. You should add a line at the bottom to should where the email was sent from. Think of all the people that we send emails to everyday. If they see the line at the bottom of the email from you and from all of us that like Lotus Notes.

Soon I think people will start saying to each other I also want an inbox that does more.

Exactly what you add in your email signature isn’t that important, the main thing is that you add something.

Speak out and join the community that’s what Social is about. 

My original line was

Sent by Lotus Notes – More than an inbox

Per Henrik LaustenPer Henrik Lausten

thought we should change the line so it looked more like the iphone

Sent from Lotus Notes – More than an inbox 

Mat NewmanMat Newman

Wrote his own post regarding this and thought of the line

This message was sent from IBM Lotus Notes – MORE than an inbox

Dave Armstrong commented Matts post and thought that we should

 add this line into applications that is using domino

Serdar BaşeğmezSerdar Başeğmez – Sent out this twitter post

I have added this line to my email signature!! “Sent by Lotus Notes – more than an inbox.”. Your turn! 

Feel free to comment that you join this social activity.

XPages Q&A tomorrow, also XPages 8.5.4 update

Check out what’s new in 8.5.4 regarding XPages.
Ask your XPages questions tomorrow to IBM Specialists.

Do not miss this event
Link to the meeting info

Check out the presentation –> Link

If you can’t attend ask your questions here 

 

Check out the new version of Small Talk live Demo

Openntf has enabled to so you can test some of the applications live
check it out here Link 

If you like what you see and I think you do you can get your own copy here Link

Read more what new in Small Talk –> Link

 Small Talk moves the internal communication to new limits, everybody knows everything and that’s instant!!

Small Talk 2.0 – Move your internal communication to new limits

Small Talk Release 2.0 has been released on OpenNtf.org

This release has what I think important improvements that gives a new angle of Social
It’s great with likes and retweets of you posts. But with the new version your coworkers can
Flattr you for internal posts done in Small Talk. Internal posts you might say that is internal and you can write about it and certainly not use Flattr. Well that is taken care of in Small talk, Small Talk will only send to Flattr that something has been Flattred using a Small Talk Post. So your secrets is safe with Small Talk.

The new version also includes alot of improvments as Reader user acess now works, Avatar images works, Tag Clouds for popular taggs and Users is displayed and alot of other improvmements.

Small Talk is now even more the tool for you internal communication or storage point for all infomation that you can’t put in your CRM or Development system.

Take Small talk for a test drive and let me know what you think 

Download Small Talk here

Lotus Notes, XPages Tagline Update

We had some talk on twitter using the hashtags

https://twitter.com/#!/search/%23lotusnotestag
https://twitter.com/#!/search/%23XPagesTagline

My own tagline suggestions for Lotus Notes and XPages are

Lotus Notes – More than a inbox

XPages – Xtending your business

What do you think, post a comment!

I have an Social Idea with these taglines but I will come back to that in a later post.