سؤال

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 uncomment 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 is fr-form-model. (You'll also find more information about the ev:observer and ev: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" />
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top