Here is the scenario…

You have a text edit box, and when you leave that field (onBur) you fire a partial refresh to update some other values on the page.  Now since it is refreshed the focus of the cursor may not be where the user clicked on the form, worse – what if the user clicked a cancel button or another button?  The user will have to click it twice, once for the partial refresh and then once to fire the button.

With a little help from Paul Withers i think i have found a good solution to this issue.

First on the Xpage in the onClientLoad() event lets declare our 2 variables

var cancelRefresh = "";
var focusOnMe = "";

Next we go to the field with the onBlur() event that fires the partial update.

Click on the onBlur() event, then click on the client tab.  In the script area enter this code where yourfieldid is the id of the field you are editing.

if(dojo.byId("#{id:yourfieldid}").value ==""){return false};
if(cancelRefresh =="Yes"){
cancelRefresh ="";
return false;
}

Next we are going to go to the outline.  In the Outline you can expand the field and see event handlers.  Click on the event handlers, then the properties tab to the right.

Then scroll down until you see the onComplete property.  Click on it and enter this code.

if(focusOnMe != ""){
dojo.byId(focusOnMe).focus();
focusOnMe =""
}

This will focus on the field we just clicked on.

The next step is to go to a button, like a cancel button, or to a field.  Click on the onMouseDown event and enter this code on the Client tab.

For a button, tell it not to update

cancelRefresh ="Yes"

For a field, tell it where to focus, where yourfieldid is the id of the field

focusOnMe = "#{id:yourfieldid}"

That should get you immediate actions on your buttons and focus on the fields you click on after the refresh has occurred.

 

This application allows you to view, edit, and create your Lotus Notes Tasks while offline on your iPhone and Android  device.  No mail or system templates need to be modified. Just install this on any 8.5.2 or above server in your environment and “Get Things Done”. The user mail files can be kept untouched on their original mail server. No upgrades needed!!

 

 

Download here Project Link

 

 

 

 

I have just released mAddressBook to OpenNTF for the new development competition.  You can sync any addressbook on your server to your phone with this application.  It works offline on iPhones and iPads and should work offline with Android as well.  There are two themes included, please let me know any comments you might have, thanks

 Download

 

Another trick to get your Xpage to load faster

On October 20, 2011, in Uncategorized, by Mark Hughes

I HATE  twisties on views on the web!!  I like to use combo-box’s at the top to filter the results.

Recently i ran into an issue getting the values for the combo-box’s.  You see, I used to just do a @DbCloumn to get the values then throw a @Unique() around that  to get my list.  And that seemed to work ok for small views, BUT in this application it had 100k documents and was taking 10-14 seconds to load the page.  I then rethought how I would get values from now on.

The first thing I did was create a new view with one column, the value i needed, and categorized it.  Next I changed the code in the computed values in the combobox to create an array, and use a ViewNavigator to get the values.

//get all end dates and then sort them

var arraydate = new Array()
var view1 = database.getView('enddates')

var nav:NotesViewNavigator = view1.createViewNav();
var entry:NotesViewEntry = nav.getFirst();
while (entry != null) {
	if (entry.isCategory()) {
		arraydate.push(entry.getColumnValues().firstElement().toString())
	}
	var tmpentry:NotesViewEntry = nav.getNextCategory();
	entry.recycle();
	entry = tmpentry;
}

//sort function for dates found on web somewhere
var dateRE = /^(\d{2})[\/\- ](\d{2})[\/\- ](\d{4})/;
function mdyOrdA(a, b){
a = a.replace(dateRE,"$3$1$2");
b = b.replace(dateRE,"$3$1$2");
if (a>b) return 1;
if (a <b) return -1;
return 0; }

arraydate.sort(mdyOrdA)

 

Notice the use of getNextCategory(), at fist i was using getNextEntry(date1), and that cut the load time in half, using getNextCategory() made it seem to load almost instantaneously.

Now if these values wouldn’t change very often(but they do), i would load this into an applicationScope and let the app check for its existence and only build it when the applicationScope expired.


 

 

 

My favorite 8.5.3 feature has a small flaw

On October 4, 2011, in Uncategorized, by Mark Hughes

Great news this seems to have been fixed in the Gold code!!  My errors were with 8.5.3 cd5

 

First This is one of my favorite features in 8.5.3, but there is on caveat i have found just this past weekend.

When “Use Runtime Optimized CSS an JS Resources”  is checked on the XPage tab on application properties,

and you have a css file that refferences an image like

background-image:url(‘./test.png’)

 

It will NOT display the image.

For some reason the browser thinks the image is a css file, and not an image.  It even puts it in a css named folder.  To get around this include those styles on the page instead of in a css file.  I will submit this to IBM to see if we can get it fixed.

 

Xpage ViewPicklist CC reaches 1000 Downloads

On September 8, 2011, in domino, lotus, xpages, by Mark Hughes

Thanks to all who have downloaded this custom control, i hope you enjoy using it as much as i do. I submitted this control to enter the Openntf custom control contest, though i didn’t win, i am glad it has helped so many people.

Please let me know if there are features that you would like to be added, or ideas about what could be changed.  Yes Dwain, i have seen your suggestions, but haven’t got to them yet.

 

Please make sure you have the latest version, thanks again

Download

 

View Pick-list Custom Control on OpenNTF

On August 30, 2011, in Uncategorized, by Mark Hughes

There is a new version available that takes care of two things.

1.  The white-space on the loading mask when inserted at the top is now gone.

2.  Added new property for custom validation message on the multi-value deselect box.

You can get it here .

Please let me know if there are any new features or bugs that you have found, thanks and i hope you enjoy this control.

 

Xpage View Picklist setup video

On August 18, 2011, in Uncategorized, by Mark Hughes

Here is a short video of how to set up the view picklist custom control.  I want to thank John Jardin for his work producing this video which shows how to set up the custom control and implement it in its basic form.

Video

Link to Control

 

For a longer video you can visit notesin9.com and look for the viewpicker custom control.

 

New ViewPickList Custom Control version on OpenNTF

On August 17, 2011, in lotus, xpages, by Mark Hughes

The changes are below, have fun and go download it!

http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=View%20Picklist%20Custom%20Control

Changes

Combined both of my controls into 1 database with one set of resources.  This handles refreshing of the control from a source other than itself, and now works well with Loading MAsks since they now both use the hijackpartialrefresh function.

All three(ViewPicklist, Multivalue Deselect Box, and Loading Masks) controls are included but none of them rely on the others to work, so just use what you want and leave out the rest.

 

Make sure to copy over all the resources of the database in the code-scripts- images and files and style sheets,for the names have been changed!

Added SelectCellWidth property to set the cell width of the column that contains the select button or link.

 

Added version info to all controls that show in designer.

 

 

Stephan Wissel suggested i add this functionality, to be able to remove items from the list without opening the picklist again.  This control can be used stand alone as well for showing multivalue fields set from other sources besides the view picklist.

Thinking Dojo Dnd to reorder items might be next on the list

It is included in the ViewPicklist Custom Control project on Openntf.org, so go download the new version!

 

You can choose whether it is horizontal or vertical, text for the remove button or a picture, and field width.