xforms-ready dispatched but action not fired
I have the following code in my xforms based form:
<!--<xforms:action ev:event="xforms-select" target="retrievalControl-control">-->
<xforms:action ev:event="xforms-ready" target="fr-form-model">
<xforms:send submission="loadConfiguration"/>
</xforms:action>
If I u开发者_如何学编程ncomment the commented line above (and comment out the line containing xforms-ready), I get the expected results (i.e., the submission gets called upon selecting the targetted control), but if I keep the code above as it is, then I can see in the logs that xforms-ready event has been fired for the model stated, but this submission does not get called. The submission is actually defined in the correct place (i.e., the model referred to, which in fact, is the only model defined in my xforms based form)
What could be the reason behind the submission not getting invoked upon xforms-ready for this model?
The xforms-ready
event is dispatched to the model, so you can either:
- Place the event handler inside the model, as you mentioned in your own answer.
- Place it anywhere else, but add the attribute
ev:observer="fr-form-model"
, assuming the id of your model isfr-form-model
. (You'll also find more information about theev:observer
andev:target
attributes.)
Solved this by moving the code snippet above to the model itself, rather than elsewhere (was present in the xhtml body earlier, while the model was in xhtml head). The below-mentioned also work when placed in the model itself:
<xforms:action ev:event="xforms-ready">
<xforms:send submission="loadConfiguration"/>
</xforms:action>
and
<xforms:send ev:event="xforms-ready" submission="loadConfiguration" />
精彩评论