Re: Readonly, relevant attributes for trigger

Hi Guntis,
I, like yourself have only been working actively in XForms for the past 
few years, but also had issues with XForms coming from a background 
where it would be sensible to add a property such as relevant and 
read-only to a trigger.
My understanding and interpretation of the reasons behind this can 
probably be corrected by others with more background than mine but here 
is how I see it.

XForms attempts to encapsulate the Model-View-Controller architecture 
that is common within the development world.  As such the idea of having 
a model (xforms:model, xforms:instance) seems to be easy to grasp.  The 
view is easy as well in an xhtml world (xf:input, xf:output, xf:trigger 
etc).  But where is the ** xf:controller **. To me the controller is the 
<xf:bind relevant="" /> and friends as well as the <xf:action /> within 
the model.  Or at least that is how I write xforms.  So how then to 
communicate the intent of the controller to the view.  By definition the 
view receives its data from the model so this is the 'M-V' part.  But 
what if you have multiple views.  I write forms that have at least 2 
views per form, one is for when viewing as a css rule media="screen", 
another is media="print" while others will add css for media="mobile", 
or in fact the 'view' could be one of at least the 10 already defined 
media types, so if there are triggers on each css rule with a 
corresponding view of:

<body>
    <div class="screenview">
       .. all xforms controls needed for a desktop
    <div>
    <div class="printview">
    </div>
    <div class="mobile">
    </div>
</body>

What about the code-bloat to which you refer.  Every control (input, 
output, trigger etc) will need to have the relevant or readonly or any 
other mip attribute duplicated.

So given that by binding the relevancy of a control to the M-V 
relationship by the controller as there may be a M-V-V-V-V-V-V-V 
relationship in a complex form with many possible renderings (I have 
only dealt with a M-V-V-V at the present, or M-Screen-Print-Mobile) 
within a form.  Being able to control each view my form can render 
within with a single <bind relevant="" /> statement seems like a really 
nice idea to me.

So in answer my answer to your questions is as follows:

Why bind to any node:
So you can define your own variable to control the relevance of any 
control.  I usually define an instance called mdlForm which has empty 
nodes that are the relevance controllers:

<instance id="mdlForm">
    <variables xmlns="">
       <Trigger1Visisble />
    </variables>
</instance>

 <bind nodeset="instance('mdlForm')//Trigger1Visible" relevant="...." />

and so on.

Why not interact with form data?
A trigger initiates an event which can be used by the controller to 
perform an action.  The relevance is determined by the relevancy of the 
node to which it is bound.

Which MIP property is relevant?
The only one which I have found to be useful in xhtml forms is relevant, 
however the trigger in xhtml is normally a button, in a audio form it 
could be some other type of control (voice, braille etc) so the other 
MIP properties may be useful in this scenario.

I hope my interpretation of a trigger and why it is good that the 
controller is separated from the view in XForms is useful, others of 
course may have different reasons for the same conclusions.

Regards

Received on Tuesday, 13 February 2007 07:16:57 UTC