Note to all: to make this work I will have to upgrade Cocoon to use JXPath 1.1b1. JXPath 1.0 has bugs that make it unusable for this purpose. Let me know if you think this will be a problem.
Regards,
Chris
Ugo Cei wrote:
I've attached a modified xmlform.js file that implements the following change: the methods "sendView" and "finish" take an extra "bizData" argument that has the same meaning as the "bizData" argument of sendPage and sendPageAndWait. I need this because many of my pages contain forms but also other data that is not tied to the model being edited in the form.
Christopher, please review the proposed change, thank you.
Ugo
// XML Form Feedback Wizard Application
function feedbackWizard(xform) { var bean = { firstName: "Donald", lastName: "Duck", email: "[EMAIL PROTECTED]", age: 5, number: 1, liveUrl: "http://", publish: true, hidden: true, count: 1, notes: "<your notes here>", favorite: ["http://xml.apache/org/cocoon", "http://jakarta.apache.org", "http://www.google.com", "http://www.slashdot.com", "http://www.yahoo.com"], hobby: ["swim", "movies", "ski", "gym", "soccer"], allHobbies: [ { key: "swim", value: "Swimming" }, { key: "gym", value: "Body Building" }, { key: "ski", value: "Skiing" }, { key: "run", value: "Running" }, { key: "football", value: "Football" }, { key: "read", value: "Reading" }, { key: "write", value: "Writing" }, { key: "soccer:", value: "Soccer" }, { key: "blog", value: "Blogging" }], role: ["Hacker"], system: { os: "Linux", processor: "p4", ram: 512, servletEngine: "Tomcat", javaVersion: "1.3", } } xform.setModel(bean); xform.sendView("userIdentity", "wizard/userIdentity.xml", function(xform) { var bean = xform.getModel(); print("I can also do validation in JavaScript"); if (bean.age > 30) { xform.addViolation("/age", "Hey, you're too old"); } }); print("handling user identity"); xform.sendView("deployment", "wizard/deployment.xml", function(xform) { var bean = xform.getModel(); print("I can also do validation in JavaScript"); if (bean.publish) { xform.addViolation("/publish", "Sorry, I won't let you publish"); } }); print("handling deployment"); xform.sendView("system", "wizard/system.xml"); print("handling system"); xform.sendView("confirm", "wizard/confirm.xml"); print("handling confirm"); xform.finish("end", "wizard/end.xml"); print("done"); }