i think you need the ajax_trap parameter to LOAD():

{{=LOAD('default','ajax1.load', ajax=True, user_signature=True, 
ajax_trap=True)}}

if that does not work, can you run the code with a HTTP inspector in the 
browser to see what URLs are actually being fetched when?  i suspect that 
the LOADed component is not posting to the right URL.

cfh

On Sunday, September 16, 2012 5:52:12 PM UTC-7, shartha wrote:
>
> I have a form containing a text field and the submit button on a jQuery-UI 
> modal. The modal will be shown if the user clicks on a link on the page. If 
> the user clicks on the submit button of the form on the modal, a database 
> row should be updated. However, the form does not get processed 
> successfully if it is loaded on a modal. 
>
> Here is the code in the controller:
>
> *def ajax1():*
>     editDetailsForm = SQLFORM.factory(
>         Field('zip',label="zip"),
>     )
>
>     if editDetailsForm.process().accepted:
>         response.flash = "Accepted"
>         db(db.auth_user.id == auth.user.id).update(zip=request.vars[1])
>     else:
>         response.flash = "NOT Accepted"
>     return dict(editDetailsForm = editDetailsForm, zip = zip)
>     
>     
> @auth.requires_login()
> *def ajax():*
>     return dict()
>
> and here is the code in the views:
>
> *# for ajax.html:*
> {{extend 'layout.html'}}
> {{=LOAD('default','ajax1.load', ajax=True, user_signature=True)}}
> {{=response.toolbar()}}
>
> *# for ajax1.html:*
>
> <script type="text/javascript">
> $(document).ready(function() {
> $('div#thedialog').dialog({ autoOpen: false })
> $('#thelink').click(function(){ $('div#thedialog').dialog('open'); });
> })
> </script>
>
> <div id="thedialog" title="Download complete">
>     {{=editDetailsForm}}
> </div>
>
> <a href="#" id="thelink">Clickme</a>
>
> Please note that the zip field is added to the user table. What baffles me 
> is that if you replace the ajax1 function and ajax1.html with the ajax 
> function and ajax.html, the modal works flawlessly and the database will be 
> successfully updated. Please let me know if my code contains any errors or 
> if you know how to resolve this issue.
>
> Thanks!
>

-- 



Reply via email to