Hello again,
Well... this took me a while ....
I couldn't get it to work at first... the template ajax.php is working but sending the querystring didn't work, at least not to the final embedded form. Couch kept asking for a page_id and when I set this manually the modal was showing up blank. Anyhow figured (finally) out how to solve this by creating a skeleton modal (blank) with an id of ajax and set the contents of the embedded files in the ajax.php to the content of the modal. So the link became:
As you already suspected
Now the modal shows the correct info only the form won't save the data !!?
I had a redirect if k_success in the form and had to set in the ajax.php one extra variable(ajax_link) to redirect back to the original page, did use set_cookie to hold the page link.
the form looks like this:
Any ideas why this won't save the data ?
Well... this took me a while ....
I couldn't get it to work at first... the template ajax.php is working but sending the querystring didn't work, at least not to the final embedded form. Couch kept asking for a page_id and when I set this manually the modal was showing up blank. Anyhow figured (finally) out how to solve this by creating a skeleton modal (blank) with an id of ajax and set the contents of the embedded files in the ajax.php to the content of the modal. So the link became:
- Code: Select all
<a href="<cms:add_querystring link="<cms:link 'edit_order.php'/>" querystring="act=edit&what=order_line&id=<cms:show k_page_id />"/>" class="label" data-reveal-id="ajax" data-reveal-ajax='true'><i class="foundicon-edit"></i></a>
As you already suspected
For now let's just focus on getting the correct form to display in the modal window before we deal with the submission of said forms.
Now the modal shows the correct info only the form won't save the data !!?
I had a redirect if k_success in the form and had to set in the ajax.php one extra variable(ajax_link) to redirect back to the original page, did use set_cookie to hold the page link.
the form looks like this:
- Code: Select all
<!-- start form -->
<cms:form
masterpage='sales_transactions.php'
mode='edit'
page_id=ajax_id
enctype='multipart/form-data'
method='post'
anchor='0'
>
<cms:set my_action="edit_page_<cms:show ajax_id />" />
<cms:if k_success >
<cms:validate_nonce my_action />
<cms:db_persist_form
_invalidate_cache='0'
k_page_title="<cms:show sa/><cms:show sa_no/>-<cms:show frm_item/>"
/>
<cms:redirect "<cms:link ajax_link />" />
</cms:if>
<div class="row collapse">
<div class="small-3 large-2 columns">
<span class="prefix">Description</span>
</div>
<div class="small-9 large-10 columns">
<cms:input type="bound" name="item"/>
</div>
</div>
<div class="row collapse">
<div class="small-3 large-2 columns">
<span class="prefix">Amount</span>
</div>
<div class="small-9 large-10 columns">
<cms:input type="bound" name="amount"/>
</div>
</div>
<div class="row collapse">
<div class="small-3 large-2 columns">
<span class="prefix">Price</span>
</div>
<div class="small-9 large-10 columns">
<cms:input type="bound" name="price"/>
</div>
</div>
<cms:if (my_user_team=='Accounting') || (my_user_team=='Management') >
<div class="row collapse">
<div class="small-3 large-2 columns">
<span class="prefix">VAT</span>
</div>
<div class="small-9 large-10 columns">
<cms:input type="bound" name="vat"/>
</div>
</div>
<br/>
</cms:if>
<cms:input name='nonce' type='hidden' value="<cms:create_nonce my_action />" />
<input type="submit" name="submit" class="button small" value="Save"/>
</cms:form>
Any ideas why this won't save the data ?