Thank you Anthony this is much better greatly appreciated. On Saturday, May 17, 2014 9:27:35 AM UTC-5, Anthony wrote: > > It's still not quite clear what's going on, but this approach seems > unnecessarily indirect (i.e., copying the row ID to an input field, and > then using the ajax function to send that value to a function that returns > a component, which then calls another function to produce a form). > > Instead, why not just create an Ajax component directly upon button click: > > links = [lambda row: BUTTON('Profile', > _onclick="jQuery.web2py.component('%s', > 'ab');" % \ > URL('default', 'companypage.load',args > =row.id), > **{'_data-toggle': 'collapse', '_data-target' > : '#ab', > '_class' : 'two btn btn-success', '_type' : > 'submit', > '_value' : 'Submit', '_id' : 'ld'})] > > In that case, you no longer need the new() function, and you can also get > rid of the form with the "id5" input field. jQuery.web2py.component() will > make an Ajax call to /default/companypage.load/[row.id], which will > return the form for that record and load it in the "ab" div. > > Anthony > > On Friday, May 16, 2014 4:27:10 PM UTC-4, LaDarrius Stewart wrote: >> >> links = [lambda row: BUTTON('Profile',_onclick="jQuery('#id5').val('%s'); >> ajax('new', ['id'], 'ab');" % str(row.id), **{'_data-toggle': >> 'collapse', '_data-target' : '#ab', '_class' : 'two btn btn-success', >> '_type' : 'submit', '_value' : 'Submit', '_id' : 'ld'} )] # Companysearch >> method grid links to create button >> >> def new(): >> return LOAD('default','companypage.load',ajax=False, ajax_trap=True, >> args=[request.vars.id]) >> >> def companypage(): >> a = request.args(0) >> company = db((db.Company.id==a)).select().first() >> record = db.Company(request.args(0)) >> form3=SQLFORM(db.Company,record=record,formstyle="bootstrap") >> if form3.process(session=None, formname='form123213').accepted: >> response.flash = 'Working' >> return locals() >> >> <form><input class="" id="id5" name="id" value="" /></form> >> #companysearch.html >> <div class="collapse" id="ab"> </div> #also within companysearch.html >> >> >>
-- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.