- From: Mark Birbeck <mark.birbeck@x-port.net>
- Date: Mon, 24 Jul 2006 22:27:41 +0100
- To: www-forms@w3.org
Steven/Erik, Just so that we don't lose one of Andrew's key points though, he does rightly flag up that there is no way in XForms to get values from one model into calculations in another model, or to use another model to provide template nodes for copying via xf:insert, and so on. There is no reason not to allow this, and in fact there are many, many situations where we positively need it. I would say that the main justification *for* is that once you get to forms of a certain complexity they are just far too difficult to build and maintain by hand. At this point you need to generate them, and to do that you will invariably want to use models to provide encapsulation. As it happens, even if your forms aren't that complex, if you want to reuse features across many forms, it makes sense to use multiple models. For a fuller description of using models to provide encapsulation and reuse, see my previous post at the end of the following thread, on "Use cases for multiple models": http://lists.w3.org/Archives/Public/www-forms/2006Jul/0014.html By the way, I'm not saying that we should allow cross-model dependencies... well, I'm not saying that today, at least ;). In formsPlayer we provide a globalInstance() function that allows you to make a reference to an instance that is in any model, but as with calling the now() function, it's not dynamic, and so the author needs to be aware that they may need to use rebuild in certain situations. But in simple situations like the one we have here, where you just want to use a model to hold the user's preferences which are in turn used for submissions, then rebuild is simply not a problem, and globalInstance can be used straightforwardly. Regards, Mark On 24/07/06, Erik Bruchez <ebruchez@orbeon.com> wrote: > > Andrew, > > > I'm testing the form on both Orbeon's Presentation Server (current > > release) along with Mozilla XForms 0.5 (0.6 said it had an invalid > > checksum and wouldn't install for me) in case it matters. I don't > > really think it does, because one of the points in Dubinko's book > > was "options for cross-model communication are limited." > > Unfortunately, I can't find much on what those options are. I > > suppose I could resort to using some JavaScript to solve the > > problem, but I would really rather not do it that way. > > If you download the latest OPS nightly build [1], go to the DMV Forms > example, and open a form, you will see there what I think is a really > cool illustration of i18n with a dropdown allowing you to switch at > runtime between English and French resources (he he, this is not > something you see often, to say the least, and XForms makes it a > breeze to achieve). > > As suggested by others, simply load your initial resources into an > instance (alternatively, you can run a submission upon xforms-ready): > > <xforms:instance id="resources-instance" src="resources_en.xml"/> > > There is another instance holding the current language: > > <xforms:instance id="language-instance"> > <language xmlns="">en</language> > </xforms:instance> > > There is an xforms:select1 to change the language: > > <xforms:select1 ref="instance('language-instance')"> > <xforms:label > ref="instance('resources-instance')/labels/language-choice"/> > <xforms:item> > <xforms:label>en</xforms:label> > <xforms:value>en</xforms:value> > </xforms:item> > <xforms:item> > <xforms:label>fr</xforms:label> > <xforms:value>fr</xforms:value> > </xforms:item> > <xforms:send ev:event="xforms-value-changed" > submission="update-language-submission"/> > </xforms:select1> > > which runs a submision that updates the resources: > > <xforms:submission id="update-language-submission" > ref="instance('language-instance')" > action="/forms/service/resources/{.}" validate="false" > method="get" replace="instance" instance="resources-instance"/> > > All the internationalized resources in the page are referred to with > things like: > > <xforms:output ref="instance('control-instance')/message"/> > <xforms:label > ref="instance('resources-instance')/labels/language-choice"/> > > This is much more flexible than to hardcode xml:lang in the page, and > it works like a charm. > > I hope this helps, > > -Erik > > [1] http://forge.objectweb.org/nightlybuilds/ops/ops/ > > -- > Orbeon - XForms Everywhere: > http://www.orbeon.com/blog/ > > > -- Mark Birbeck CEO x-port.net Ltd. e: Mark.Birbeck@x-port.net t: +44 (0) 20 7689 9232 w: http://www.formsPlayer.com/ b: http://internet-apps.blogspot.com/ Download our XForms processor from http://www.formsPlayer.com/
Received on Monday, 24 July 2006 21:27:50 UTC