I’m having some fun in a legacy application at work. The Lotus Notes/Domino forms I am creating and maintaining are embedded into an ActiveX frame (like a portal).

Prior to this application, I think all of my development has been under the assumption that my HTML form was the only form. Hence, document.forms[0] was my standard. Well, now that I’m working in this embedded application, that isn’t always true. I’ve had to rewrite some of my javascript to work with the current form.

Here’s a few of my current nuggets.

The first thing I had to create was a function to get the current form.

function getMyForm(field) {
// returns form element
	if (typeof(field) == "string") {
		for (var i = 0; i < document.forms.length;i++) {
			if (document.forms[i][field] != null) {
				return document.forms[i];
			}
		}
	} else {
		var element = field;
		while (element != null) {
			element = element.parentElement;
			if (element.tagName == "FORM") {
				return element;
				break;
			}

		}
	}

}

I am still debating how to implement the next function. I wasn’t sure if I should pass the form into the function, expect that I already have it (bad design), or get it using the function above. I actually do a mixture of the last two options. I typicall set a global form variable in the JSHeader but check for it in case it is not there.

function getFieldValues(field) {
// Returns array of values. Depends on getMyForm.
	var value = new Array;
	if (form == null || form.tagName != "FORM") {
		var form = getMyForm(field);
	}
	if (typeof(field) == "string") {
		var theField = form[field];
	} else {
		var theField = form[field.name];
	}

	if (theField.length == null && theField.options == null) {
		value =  [theField.value];
	} else if (theField.options != null) {
		for (var i = 0; i < theField.options.length;i++) {
			if (theField.options[i].selected == true) {
				value.push(theField.options[i].text);
			}
		}
	} else if (theField.length >= 0) {
		for (var i = 0; i < theField.length;i++) {
			if (theField[i].checked == true) {
				value.push(theField[i].value);
			}
		}
	} else {
		value = [''];
	}
	return value;
}

This is nothing new for a lot of developers and frameworks like jQuery and Prototype handle a lot of this. But in many instances, you’re stuck in legacy code that doesn’t allow you to throw in frameworks (or you really don’t want to have to explain what you’re doing to the other developers).

by tom | Categories: lotus, web design | No Comments

Damir Tomicic - Being a good developer is 3% talent, 97% not being distracted by the internet.

(via .NET Buzz Forum)

by tom | Categories: general | No Comments

A handy list of cheat sheets (HTML, CSS, Javascript, etc…).

I still live and die by my VisiBone Browser Book but some of the jQuery cheatsheets will be handy.

(via del.icio.us)

by tom | Categories: web design | No Comments

Help

Jul 2, 2008

Dear loyal readers (all two of you). I need Lotus Notes help badly.

Please ask your Lotus Notes developer friends if they’ve have any ideas on how to help me.

We just upgraded from R6 to R8 and now my namgr.exe.config or nserver.exe.config files stopped working. It’s like it can’t see them.

We were using a 3rd party COM library for a Notes app. The COM library is created using .Net framework and acts as a proxy to a (microsoft) web service. It requries a config file which must be named “[my_app_name].exe.config”.

I tried to name the config file as “notes.exe.config”, and “nlnotes.exe.config”. But it seems that Windows doesn’t work with Notes in this way.

Would appreciate any suggestion regard this.

There is a multi-beer reward.

by tom | Categories: lotus | No Comments

It’s great to read about successful Lotus Notes applications. I was browsing Linkedin when I found this:

Michael Janas’ company bid out an application but decided to develop it in-house on the Lotus platform. It’s answer #2 on the list.

I had the same requirements, looked around at software, was caught off guard by the costs and IT reqmts, so decided to use in-house talent to develop a system based on Lotus Notes. Didn’t take a lot of time to develop and only three weeks to Beta test and then launch enterprise wide with 5200 employees and 375 managers or requisitioners.

Sometimes… I just want to scream “Hey CIO! I’ve got money saving applications over here!”

Thank you Michael Janas for publishing a success story for Lotus Application development.

by tom | Categories: lotus | No Comments

My brain is like a sieve. I can’t remember simple things like how to write a “for loop.” Hence the reason I am a Lotus Notes developer… the on-line help is great.

A great find for developers like me is a table of connection strings for all types of data sources.

by tom | Categories: lotus, web design | No Comments