First, take grid out of BEAUTIFY -- not necessary.
Does db.t_dogs happen to have a field called "name"? If so, change the name
of your extra input element to something other than "name".
Also, when typing in your input field, open the browser developer tools and
see if (a) you get any JavaScript errors in the console and (b) an Ajax
request gets sent to the server.
Anthony
On Sunday, March 30, 2014 4:43:34 PM UTC-4, backseat wrote:
> On Sunday, 30 March 2014 14:08:38 UTC+1, Anthony wrote:
>>
>> Would help to see the controller code.
>>
>
> Here's the code from a test app I've put together to simplify:
>
> def index():
> grid = SQLFORM.grid(db.t_dogs,
> create=True,
> csv=False,
> deletable=False,
> details=False,
> editable=True,
> paginate=100,
> searchable=False,
> )
> return locals()
>
>
> def echo():
> print "in echo()"
> #from gluon.debug import dbg
> #dbg.set_trace()
> return request.vars.name
>
>
> What is "form", and why are "grid" and "form" inside BEAUTIFY?
>>
>
> Here's the simplified view:
>
> {{extend 'layout.html'}}
>
> <h1>Target</h1>
> <div id="target"></div>
> <hr />
> <form>
> <input name="name" onkeyup="ajax('echo', ['name'], 'target')" />
> </form>
>
> <h1>DOGS</h1>
> {{=BEAUTIFY(grid)}}
>
>
> They're inside BEAUTIFY to keep it simple for now: that is how they are
> after the application wizard has run.
>
>
>> What are you really trying to do?
>>
>
> Ultimately, I want the Add from from a SQLFORM.grid to have a dropdown
> combo and a text area (amongst other things). I want the text area to be
> populated with default text when the dropdown changes, and I was going to
> do this with AJAX.
>
> The simplified application shown above demonstrates the problem. When the
> grid is displayed, the AJAX call works as expected. When the grid "Add"
> form is displayed and characters are typed in the input area, the echo()
> function is not called.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.