Problems, need help? Have a tip or advice? Post it here.
14 posts Page 2 of 2
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:

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 ?
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
I haven't actually used Foundation's Reveal so I wasn't aware of the data-reveal-id requirement. I find that the documentation leaves something to be desired... I'm glad you were able to figure this out though.

I think the problem with the form may be with the action parameter. Could you please try add the following to your form tags:
Code: Select all
action="<cms:add_querystring link=k_template_link querystring="act=<cms:show ajax_act/>&what=<cms:show ajax_what/><cms:if ajax_id>&id=<cms:show ajax_id/></cms:if>"/>"
Thanks ... Finally.... Pfffff .... the action in the form did solve it.

I couldn't have done this without your help, thanks for that I really appreciate your support.

I find that the documentation leaves something to be desired...

Tell me something... I know, the only reason I use foundation instead of bootstrap is, foundation doesn't overwhelms with all kinds of options.

Anyhow I think my approach to try to edit a record in one template, from a list of an other template, made things (maybe to) complicated. Next time I'll rethink this one.

You should post your idea of loading all of the forms from one file under tips and tricks.

Thanks again.
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
I'm glad I could help Tom ;)
14 posts Page 2 of 2
cron