coliver 2003/02/28 11:14:35
Modified: src/webapp/samples/xmlform/flow feedbackWizard.js Log: Removed tabs, and updated to use XForm.getValue() instead of the now nonexistent XForm.xpath() method Revision Changes Path 1.2 +73 -68 xml-cocoon2/src/webapp/samples/xmlform/flow/feedbackWizard.js Index: feedbackWizard.js =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/xmlform/flow/feedbackWizard.js,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- feedbackWizard.js 23 Feb 2003 19:23:31 -0000 1.1 +++ feedbackWizard.js 28 Feb 2003 19:14:35 -0000 1.2 @@ -1,97 +1,102 @@ // 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", "Executive"], - system: { - os: "Unix", - processor: "p4", - ram: 512, - servletEngine: "Tomcat", - javaVersion: "1.3", - } + 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", "Executive"], + system: { + os: "Unix", + processor: "p4", + ram: 512, + servletEngine: "Tomcat", + javaVersion: "1.3", + } } + xform.setModel(bean); + xform.sendView("userIdentity", - "flow/userIdentity.xml", + "flow/userIdentity.xml", function(xform) { - var bean = xform.getModel(); + var bean = xform.getModel(); print("I can also do validation in JavaScript"); - print("age = "+xform.xpath("number(/age)")); - print("role = "+bean.role); - if (bean.age > 30) { + print("age = "+xform.getValue("number(/age)")); + print("role = "+bean.role); + if (bean.age > 40) { xform.addViolation("/age", "Hey, you're too old"); } }); print("handling user identity"); + xform.sendView("deployment", "flow/deployment.xml", function(xform) { - var bean = xform.getModel(); + 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", "flow/system.xml"); print("handling system"); + xform.sendView("confirm", "flow/confirm.xml"); print("handling confirm"); + xform.finish("end", "flow/end.xml"); print("done"); }