gal007
gal007

Reputation: 7202

Keeping values in XSLTForms wizard (multi step forms)

I'm building a wizard with the XSLTForms implementation of XForms, and I'm having a trouble with multi-step forms. When I complete data in form1 and navigate to form2, all the data entered in form1 disappears. In order to navigate, I use a trigger

<xf:trigger>
    <xf:label>Next</xf:label>
    <xf:action ev:event="DOMActivate">
        <xf:load show="replace">
            <xf:resource value="form2.xml"/>
        </xf:load>
    </xf:action>
</xf:trigger>

I suppose the problem is I am not saving the model, so I added a submission to my model:

<xf:submission id="saveData" resource="data.xml" ref="instance('person')" method="put" validate="false" relevant="false" replace="none" />

So I replaced the "Next" trigger with a submit:

<xf:submit submission="saveData">
    <xf:label>Next</xf:label>
    <xf:action ev:event="DOMActivate">
        <xf:load show="replace">
            <xf:resource value="form2.xml"/>
        </xf:load>
    </xf:action>
</xf:submit>

But still have a problem: the navigator asks the user for permission to write the file, and I really want to do that at the end, not in every form.

Is there any alternative to this? Thanks a lot!

Here an example for better understanding:

<xf:instance xmlns="">
    <person>
        <name/>                     <!--Form 01-->
        <surname/>                  <!--Form 01-->
        <height/>                   <!--Form 01-->
        <weight/>                   <!--Form 01-->
        <children>
            <age/>                  <!--Form 02-->
            <school-name/>          <!--Form 02-->
        </children>
        <has-car/>                  <!--Form 03-->
        <wanna-share-car/>          <!--Form 03-->
    </person>
</xf:instance>

Upvotes: 0

Views: 118

Answers (1)

Alain Couthures
Alain Couthures

Reputation: 1523

XForms can be used for designing a single page application.

With XForms 1.1, all the application is written into a single form. Cases can be used to display, step by step, the controls. Relevant MIP can also be used for that.

XForms implementations such as betterForm and XSLTForms have added a subform mechanism allowing parts of a form to be loaded/unloaded. Unfortunately, this has not been included in XForms 2.0 proposed recommendation so this is a non-standard mechanism.

Subforms in XSLTForms are very versatile: they can shared the same models and instances, they can also have their owns. No specific actions or functions are required with XSLTForms.

--Alain

Upvotes: 1

Related Questions