Further experiment and was able to answer my question:

On Monday, June 30, 2003, at 09:54 AM, [EMAIL PROTECTED] wrote:

I'm continuing to play with Flow and in particular, XMLForms:

Today I decided to refactor the flow-driven feedback wizard in the samples:


In particular, I wanted to get rid of the inlined validation function definitions in the calls to Xform.sendview ().

The solution is that while you still have to call the function wrapper in the arguments, you can define your functions elsewhere thus:

function UserInfo_validateUserIdentity (xform)
        var bean = xform.getModel();
        print("I can also do validation in JavaScript");
        print("age = "+xform.getValue("number(/age)"));
        print("role = "+bean.role);
        if (bean.age > 40) {
                xform.addViolation("/age", "Hey, you're too old");

UserInfo.prototype.validateUserIdentity = function (xform)
        UserInfo_validateUserIdentity (xform);
function (xform) { userinfo.validateUserIdentity (xform); });

and now the refactored example works as before.

-- whump

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to