RE: Re: Reusing a form in another form

How about the following approach?

-------------------
There is a main (parent) form and a subform.  The main form carries a large instance that contains all the data that is to be eventually sent out.  

(This is just a example.  There may be many subforms, and a parent form may itself be a subform of another form.)

The subform is a complete form in its own regard.   The instance of the subform is given by a linking attribute.  The link points to a resource that is a fragment of the current instance infoset of the parent form (i.e., something that exists at runtime within the parent form's XForm processor).

The main form does not bind any model item properties to the nodes within the fragment of the instance that is handled by the subform.  Also, the main form does not bind any form controls to those nodes.

The subform has an "OK" submit control and a "Cancel" trigger.  The submission method is a QName (with or without a prefix) that signifies that the final instance data is not to be sent anywhere (and not even serialized).   However, the submission is invoked normally, and therefore, when the submit control is activated, the processor will validate the subform's instance data (which, again, is a portion of the main form's current instance data) and will close the subform.  The activation of the Cancel trigger, instead, will do a reset and will close the subform.

The subform is loaded by using <load show="new">.   If and when <load show="embed"> is standardized, that will work as well (or better).
-------------------

I think this approach solves the problem and is fully conforming to the current XForms Recommendation (although it could be improved by the introduction of <load show="embed"> and other provisions).

Any comments?

Alessandro



> -----Original Message-----
> From: Alessandro Triglia [mailto:sandro@mclink.it] 
> Sent: Wednesday, August 02, 2006 15:18
> To: Alessandro Triglia (MC-link email)
> Subject: Re: Reusing a form in another form
> 
> 
> What is the general feeling about this mechanism?  Is it 
> something that is likely to be added to XForms 1.1?
> 
> I have been thinking about how an XInclude-based mechanism 
> could work, and (unless I am missing something) it entails 
> pointing to several distinct fragments of the "form 
> definition" from several distinct places in the larger form 
> -- for example, put an <xi:include> at some point(s) in the 
> instance, pointing to somewhere within the instance of the 
> subform;  put an <xi:include> at some other point in the 
> model, pointing to some <bind> or <submission> element within 
> the subform;  put an <xi:include> within some form control, 
> pointing to some form control within the subform, and so on.
> 
> Is there a better way or any other way of reusing a form via XInclude?
> 
> If there is not, then I think that a better solution is 
> needed, and should be something "native", defined within the 
> XForms standard itself.  Ideally, I would like a single 
> "inclusion point" in the main form, not three or more; and 
> the pointer (URI) pointing to the whole subform, not to its fragments.
> 
> I think the load action, extended as described by Mark, is an 
> excellent solution.  What is unclear to me at this point is 
> how the instance data produced by the subform relates to the 
> instance data produced by the main form.  
> 
> Also, what happens to the submission and the submit controls 
> within the subform (if any)?  Does the "submission" semantics 
> change when a form is loaded as a subform?
> 
> Have these points already been raised or discussed in this list?
> 
> Alessandro
> 

Received on Wednesday, 2 August 2006 19:59:33 UTC