You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Markus Heussen <he...@rheinland-online.com> on 2003/10/07 15:51:20 UTC

Flowscript problem using function in form.sendView()

Hi all!

I'm new to Flowscript (2.1.2) and I have some problems using the jxforms
functionality. I modified the jxforms samples delivered with Cocoon and get
NullPointerExceptions always after the second wrong value. I need to use a
custom function "keyIsValid" which does some decoding and checkings for me.
This function (see below) uses an Java class (import) to do it. The function
returns the decoded key or an empty string. Even if I do the function
functionality inline I have the same negative effect.

Only if I don't do the function call the validation does what I expect. If I
do the function call, the first validation does what I expect, but if I try
a second wrong value for my identCode I get a NullPointerException.

I don't excactly know how continuations are working. So maybe after the
second request I don't have access to a program state? Can anybody help me
please?

Thanx :-)



The first flowscript file defined in the sitemap contains the following form
handler function snippet:

form.sendView("views/UserIdentification.view",
	function(form) {
		var bean = form.getModel();
		if (bean.age > 40) {
			form.addViolation("/age", "Hey, you're too old");
		}
		// if i comment out the following it works fine
		if (keyIsValid(bean.identCode) == "") {
			form.addViolation("/identCode", "Try again");
		}
	}
);


The second flowscript file defined in the sitemap contains the following
code:

importPackage(Packages.com.rheinland.online.util);

function keyIsValid(key) {
	var decodeKey = "";
	try {
		decodeKey = Encoder.decode(key);
	} catch (Exception) {
		cocoon.log.debug("Failed");
	}
	return decodeKey;
}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org