- From: David Landwehr <DLandwehr@novell.com>
- Date: Fri, 23 Jul 2004 08:24:24 +0200
- To: <mmystore@hotmail.com>, <mark.birbeck@x-port.net>
- Cc: <JBoyer@PureEdge.com>, <www-forms@w3.org>
- Message-Id: <s100bd3e.094@emea1-mh.id2.novell.com>
Hi Meghana, I have yet another suggestion which removes the need for model item properties and a special UI instance. A control which is not bound to a node becomes irrelevant and could then be styled using CSS as invisible. So the idea is to put a predicate on the single node binding for the control in such a way that when the condition is true the control is bound otherwise it is not bound and hence invisible. Here is a small example where the input control is only visible when its value is greater than 10: <xforms:instance xmlns=""> <data><a>11</a></data> </xforms:instance> <xforms:input ref="a[ . > 10 ]"> <xforms:label>A is "relevant" when its value is greater than 10</xforms:label> </xforms:input> Initially the input control is visible and when you change the value to less than or equal to 10 it becomes irrelevant. Best regards, David ---------------------------------------------------------------- David Landwehr dlandwehr@novell.com Novell, Inc. Phone: +45 33 98 15 04 Amaliegade 16C Fax: +45 70 20 15 17 DK-1256 Copenhagen K http://www.novell.com ---------------------------------------------------------------- >>> "Mark Birbeck" <mark.birbeck@x-port.net> 23-07-2004 00:38:43 >>> Meghana, The single-node binding on xf:switch does not affect the xf:case children - it is more like using a @ref on xf:trigger or xf:group. The only way to change the currently selected xf:case is via the toggle action. (The spec says that the DOM can also be used, but since there is no definition of any interfaces with which to do this, it's not actually possible.) So, to return to your original question, I would suggest you look at whether you should actually be using relevant for the situation you describe. The whole point of relevant is to remove nodes from the serialisation that takes place before submission. An additional feature is that any form controls that are bound to those nodes can be caused not to render, but since there may not actually be any controls bound to the nodes, that's to a certain extent secondary to the serialisation/submission aspect. Having said all of that, I agree with your use case, which means we need to flip things around, and firstly leave the instance data for submission alone, and then ask what other ways there are to do UI switching. One powerful technique is to create a completely new instance that is used solely to control the rendering of your form. This is a technique called 'model-based switching' (as opposed to the UI switching of xf:switch/xf:case), and an example of how this might be done is available here: <http://www.formsPlayer.com/demo/wizard/model-based-switching.htm> Note that this example will also work in other XForms processors. Regards, Mark Mark Birbeck CEO x-port.net Ltd. e: Mark.Birbeck@x-port.net t: +44 (0) 20 7689 9232 w: http://www.formsPlayer.com/ Download our XForms processor from http://www.formsPlayer.com/ -----Original Message----- From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf Of Meghana Sent: 22 July 2004 17:39 To: 'John Boyer'; www-forms@w3.org Subject: RE: use of relevance Hi John, Thanks for the reply. I checked out the switch module from Xforms specification and the example they have given uses toggle action to switch among the cases. The switch tag supports single value binding but how it can be used to select a particular case? Can you give me some example? Once again thanks for clarifying my doubts. Meghana. _____ From: John Boyer [mailto:JBoyer@PureEdge.com] Sent: Thursday, July 22, 2004 6:39 AM To: Meghana; www-forms@w3.org Subject: RE: use of relevance Hi Meghana, One option is to use a switch to control what is visible. Another is to create a submission instance distinct from the processing instance. The processing instance would have relevant MIPs, but the submission instance wouldn't. Either using calculate binds or using setvalue actions in an xforms-submit handler, copy the data to the submission instance before submission takes place. This will get easier in XForms 1.1 with a copy subtree action (which is as yet unnamed). Cheers, John Boyer -----Original Message----- From: Meghana [mailto:mmystore@hotmail.com] Sent: Wednesday, July 21, 2004 5:06 PM To: John Boyer; www-forms@w3.org Subject: RE: use of relevance I wonder how xforms handles a case when a control becomes irrelevant based on value of the instance data but the submission still needs to submit that value. Or in that case we are not supposed to use relevance and use something else? What is that other option? Meghana. _____ From: John Boyer [mailto:JBoyer@PureEdge.com] Sent: Tuesday, July 20, 2004 11:55 AM To: Meghana; www-forms@w3.org Subject: RE: use of relevance Hi Meghana, The first one. Relevance applies to instance nodes. The relevant MIP is then interpreted by both bound form controls and submission. Cheers, John Boyer -----Original Message----- From: Meghana [mailto:mmystore@hotmail.com] Sent: Tuesday, July 20, 2004 10:39 AM To: www-forms@w3.org Subject: use of relevance Hello, When a <Bind> element has relevance attribute, is it supposed to make the bound element in the XForms model relevant or the bound control relevant? In the former case, the control will see that the model is not relevant right now and hide itself; also the submission will not include that value. In the later case, the control is hidden but model still holds that value as valid data. Which approach is correct? Thanks, Meghana.
Attachments
- text/plain attachment: David_Landwehr.vcf
Received on Friday, 23 July 2004 02:37:03 UTC