Hi all!

I have solved the problem by the help of
http://www.mail-archive.com/[EMAIL PROTECTED]/msg01626.html.

The problem was the call of the static method

decodeKey = Encoder.decode(key);

(see below).


I did it like this

decodeKey = Packages.com.rheinland.online.util.Encoder.decode(key);

and it works fine!

Thank you very much Chris!

With best regards,

Markus

-----Ursprüngliche Nachricht-----
Von: Markus Heussen [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 7. Oktober 2003 15:51
An: [EMAIL PROTECTED]
Betreff: 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to