W3C home > Mailing lists > Public > www-forms@w3.org > July 2002

RE: wizards

From: Plechsmíd Martin <Martin.Plechsmid@merlin.cz>
Date: Fri, 26 Jul 2002 16:31:29 +0200
Message-ID: <E50028F23FC6D3118B7D00609761083F01D4106F@merkur.merlin.cz>
To: "'aon.912518313@aon.at'" <aon.912518313@aon.at>
Cc: "'XForms'" <www-forms@w3.org>

Hi.

Submitted xml:

	<order>
		<color />
		<amount />
	</order>

Model (I omit namespace prefixes):

	<model id="main">
		<instance>
			<order>
				<color />
				<amount />
			</order>
		</instance>
		<action ev:event="initializeDone">
			<setValue ref="/Wizard/page1/color" model="aux"
value="/order/color" />
			<setValue ref="/Wizard/page2/amount" model="aux"
value="/order/amount" />
		</action>		
		<bind ref="/order">
			<bind ref="color|amount" required="true" />
		</bind>
		<submitInfo id="submit" action="buy.asp" />
	</model>

Auxiliary model
	<model id="aux">
		<instance>
			<Wizard>
				<page1>
					<color />
				</page1>
				<page2>
					<amount />
				</page2>
				<currentPage>1</currentPage>
			</Wizard>
		</instance>
		<bind ref="/Wizard">
			<bind ref="page1" relevant="../currentPage = 1">
				<bind ref="color" required="true" />
			</bind>
			<bind ref="page2" relevant="../currentPage = 2">
				<bind ref="amount" required="true" />
			</bind>
		</bind>
		<submitInfo id="Finish">
			<action ev:event="submit">
				<setValue ref="/order/color" model="main"
value="/Wizard/page1/color" />
				<setValue ref="/order/amount" model="main"
value="/Wizard/page2/amount" />
				<submitInstance submitInfo="submit" />
			</action>
		</submitInfo>
		<submitInfo id="Next">
			<setValue ev:event="submit"
ref="/Wizard/currentPage" value=". + 1" />
		</submitInfo>
		<submitInfo id="Back">
			<setValue ev:event="submit"
ref="/Wizard/currentPage" value=". - 1" />
		</submitInfo>
	</model>

Note: I couldn't have put the <setValue>s into the submitInfo in the "main"
model, because then I wouldn't have access to the data of the "aux" model.

The form:

	<group ref="/Wizard" model="aux">
		<group ref="page1">
			<input ref="color">
				<caption>Color</caption>
			</input>
			<submit submitInfo="Next">
				<caption>Next</caption>
			</submit>
		</group>
		<group ref="page2">
			<input ref="amount">
				<caption>Amount</caption>
			</input>
			<submit submitInfo="Back">
				<caption>Back</caption>
			</submit>
			<submit submitInfo="Finish">
				<caption>Finish</caption>
			</submit>
		</group>
	</group>

Be aware that I didn't test nor reviewed the code, so that it contains bugs
and omissions. But I hope the idea is clear.


> Besides..what do you think about dynamic/computed expression in XForms
> Toggle to handle wizards?

I don't like the whole idea of toggles and switches - if you're asking me
what I think. (Toggles and switches are rother low-level operations - and
XForms is a rather high level (declarative) language.) But technically, this
could solve some issues.

	Martin.
Received on Friday, 26 July 2002 10:42:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:51 GMT