Yeah both form submit I post something about this issue here sometimes ago, let me find it back...
Richard On Tue, Mar 19, 2013 at 2:59 PM, Vincenzo Ampolo <[email protected]>wrote: > Hi, > > I'm having a problem in correctly make modal talk with web2py. I want to > achieve a simple thing: having a button that loads a SQLFORM and simply > creates a bootstrap's modal so that the user can complete the form and type > submit. > I want to use web2py LOAD such that submit of the form is handled by ajax > as well. > > So far i've this on my view: > > <a href="{{=URL(f='add_traceback'**, args=[request.args(0), > bug.tstamp])}}" role="button" class="btn btn-primary" > data-toggle="modal">Add bug</a> > > that together with this javascript: > > <script type="text/javascript"> > $(document).ready(function() { > > // Support for AJAX loaded modal window. > // Focuses on first input textbox after it loads the window. > $('[data-toggle="modal"]').**click(function(e) { > e.preventDefault(); > var url = $(this).attr('href'); > if (url.indexOf('#') == 0) { > $(url).modal('open'); > } else { > $('body').append('<div id="c282718984176">loading...<**/div>') > $('body').append('<script type="text/javascript"><!-- > web2py_component("'+url+'","**c282718984176") > //--></'+'script>'); > // $.get(url, function(data) { > // $(data).modal(); > // }).success(function() { $('input:text:visible:first').* > *focus(); }); > } > }); > > }); > </script> > > Tries to do what LOAD is supposed to do server side (I want to do the > same, but i'm client side here). > > The problem is mainly that as soon as I inject the <script> to the dom the > page loads the url and replaces the body of my page with the content of the > url instead of placing the content on the div #c282718984176 and set all > the trigger to do a ajax submit. > > Any clue in how to solve this problem? > -- > Vincenzo Ampolo > http://goshawknest.wordpress.**com/ <http://goshawknest.wordpress.com/> > http://vincenzo-ampolo.net/ > > -- > > --- You received this message because you are subscribed to the Google > Groups "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to > web2py+unsubscribe@**googlegroups.com<web2py%[email protected]> > . > For more options, visit > https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> > . > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

