- From: Colin Sagan <colin@cmbf.org>
- Date: Sat, 16 Dec 2006 22:50:56 -0800
- To: www-forms@w3.org
Hello, I am working on a system for a restaurant to update it's menu easily and I thought I'd take the opportunity to sink my teeth into xforms. I've got it displaying but I can't get it to save, and I haven't had much luck finding good examples of this process. Currently I am trying to use the formfaces javascript but have by no means exhausted the options. Just seemed like the easiest given that I don't have a lot of experience with apache and the plugins are too limited in terms of mobility. So this is what I've patched together from different examples, also, next I want to get reordering and insert/delete working so if there is anything I'm doing currently that will prevent that I would appreciate suggestions to make that easier. Thanks, Colin <?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <xf:model> <xf:instance src="breakfast-edit_test.xml" xmlns="" /> <xf:submission id="read-from-file" method="get" action="breakfast- edit_test.xml" replace="instance" /> <xf:submission id="save-to-file" method="put" action="breakfast- edit_test.xml" /> </xf:model> </head> <body> <fieldset> <legend>Menu</legend> <xf:repeat id="courses" nodeset="/menu/course"> <xf:input ref="courseTitle"> <xf:label>Course Title</xf:label> </xf:input> <xf:textarea ref="courseDescription"> <xf:label>Course Description</xf:label> </xf:textarea> <xf:repeat id="dishes" nodeset="dish"> <xf:textarea ref="description"> <xf:label>Description</xf:label> </xf:textarea> <xf:input ref="price"> <xf:label>Price</xf:label> </xf:input> </xf:repeat> </xf:repeat> </fieldset> <xf:submit submission="read-from-file"> <xf:label>Reload</xf:label> </xf:submit> <xf:trigger> <xf:label>Save</xf:label> <xf:action ev:event="DOMActivate"> <xf:send submission="read-from-file" /> </xf:action> </xf:trigger> </body> </html> ________________________________________ And the XML file (I cut it down to one dish per course so it doesn't take up so much room! <?xml version="1.0" encoding="UTF-8"?> <menu id="breakfast"> <date /> <course> <courseTitle>Coffee Bar</courseTitle> <courseDescription>Bluebottle Coffee -- Dogpatch Blend (regular/decaf) </courseDescription> <dish> <description>Espresso</description> <price>2.50</price> </dish> <dish> <description>Espresso with organic milk, macchiato, cappuccino, latte </description> <price>3.25</price> </dish> <dish> <description>Drip Coffee</description> <price>2.00</price> </dish> <dish> <description>Mighty Leaf Green Tea & Classic Darjeeling</ description> <price>2.75</price> </dish> <dish> <description>Fresh leaves, lemon verbena herbal tea</description> <price>2.75</price> </dish> </course> <course> <courseTitle>Grab & Go</courseTitle> <courseDescription /> <dish> <description>Hard boiled egg with herbed/flavored salts</description> <price>1.00</price> </dish> <dish> <description>Seasonal fruit</description> <price>1.75</price> </dish> </course> <course> <courseTitle>Bakery</courseTitle> <courseDescrption /> <dish> <description>Ginger scones</description> <price>2.25</price> </dish> <dish> <description>Croissants</description> <price>2.25</price> </dish> <dish> <description>Pain au chocolat</description> <price>2.75</price> </dish> <dish> <description>Canelets</description> <price>2.25</price> </dish> <dish> <description>Biscotti</description> <price>1.00</price> </dish> </course> <course> <courseTitle>Breakfast Pizza</courseTitle> <courseDescription>Served 7:30 to 10:00am</courseDescription> <dish> <description>Egg and truffle -- Pizza crust, sunny side up egg, truffle olive oil</description> <price>7.75</price> </dish> <dish> <description>Bacon & eggs scramble -- Hobbs bacon and eggs, scrambled</description> <price>7.75</price> </dish> </course> </menu>
Received on Tuesday, 19 December 2006 14:31:44 UTC