Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hi again!

I'm working on a behemoth of a form (which is a survey for some engineering equipment). As it turned out the multi-forms addon was a bit too unreliable for different reasons. I realised that having multiple data-bound-forms would be the better approach, as data would be saved to the template after each step and one could actually continue the whole survey at a much later point as I can controll the different steps easily.

However I would like to have two 'submit' options with the forms - as in the multi-forms-addon - with one option of submitting the current form and continuing to the next, and one submitting but going to the previous one. As all submits carry a value, I was wondering if it's possible to access this and act on it, or is there a different way to achieve this in a simple way?
'Save and go back' submit button can have a click event listener attached to it, with code setting a flag (hidden input) for backend.

It is wise to save forms live via ajax after filling each field to achieve various benefits.
Say `Please!` [̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]..... Active topics [Forum posts from previous 7 days].... [My email for friends]

As a more direct alternative to what @trendoman suggested, you may use <cms:gpc> tag ( in the form's success condition to figure out which submit button was used e.g. try this -
Code: Select all
<cms:form  method="post">
    <cms:if k_success>
        <cms:set action="<cms:gpc 'action' />" />
        <cms:if action='update' >
            <h2>Do Update</h2>
        <cms:else_if action='delete' />
            <h2>Do Delete</h2>

    <cms:input type='text' name='my_text' />
    <input type="submit" name="action" value="update" />
    <input type="submit" name="action" value="delete" />
That's wonderful, thank you!
4 posts Page 1 of 1

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests