Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hi,

I need to submit multiple forms at once. Background is as follows: Customers can submit their contact information and one or more elements which are stored as related cloned templates of another template. Now I want to send a confirmation mail to the customer with a link to complete the details of their requests. Therefore I would like to show all elements of his submission in one page in order to give him the possibility to complete or change the submitted elements. My intention now is to solve this by generating multiple forms at once, each bound to the corresponding template and cloned item. E.g.:

Code: Select all
<cms:form masterpage='customers.php' mode='edit' page_id='some_customer_id' method='post'>
    <cms:if k_success >
        <cms:db_persist_form />
    </cms:if>
    <cms:input id="customer_name" name="customer_name" type="bound"/>
    ...
</cms:form>

<cms:form masterpage='items.php' mode='edit' page_id='some_item_id_1' method='post'>
    <cms:if k_success >
        <cms:db_persist_form />
    </cms:if>
    <cms:input id="item_details" name="item_details" type="bound"/>
    ...
</cms:form>

<cms:form masterpage='items.php' mode='edit' page_id='some_item_id_2' method='post'>
    <cms:if k_success >
        <cms:db_persist_form />
    </cms:if>
    <cms:input id="item_details" name="item_details" type="bound"/>
    ...
</cms:form>


How can I make this work?

Thanks,
Olliwalli
Hi, you don't need multiple forms, in my opinion. One should suffice.
Anyway, submitting multiple forms is NOT possible, with one exception - submitting via ajax one by one without reloading of page.

The reason for making multiple forms is to use bound inputs, which are no-more-no-less just inputs with filled-in data (with some exception like "securefile" type of editable).

Data of editables can be fetched with regular tags, pages and get_custom_field, therefore in k_success, after form is submitted, data gets resaved to multiple templates one by one to the same editables via a standalone <cms:db_persist /> tag.

The task can be reformulated as 'saving 1 form inputs to multiple templates' where 'inputs are prefilled with existing values'.

I'd love to hear alternative variants to this solution.
2 posts Page 1 of 1