On Sunday, March 26, 2017 at 11:01:38 AM UTC-7, Oasis Agano wrote:
>
> Greetings
>
> I have a form built with sqlfactory
>
> form = SQLFORM.factory(
> Field('meter', requires=IS_NOT_EMPTY()),
> Field('date_from', 'datetime'),
> Field('date_to', 'datetime'),
> Field('amt', 'float'))
>
>
>
I would be inclined to just use an event handler (onchange, oninput, or
onfocus) to detect when the fields have been filled in, do a jquery call to
your controller, and refresh your div. The other approach may be to
calculate amt in the javascript, which may involve having a hidden field in
your form for the usage-price rate.
/dps
> then i want to have a form in the view where users will access the 3 first
> fields in normal mode and the amt one in
> *Readonly,*After filling those 3 i use* Ajax(Where the problem is) *to
> load a function that has a *query *in it to calculate the *amount*, then
> i fill the output of that function to the last field(amount).
>
> The problem i have is how to call that ajax *method *to *launch the query
> and auto fill the field* when those 3 fields are filled.
>
> Regards,
> Oasis
>
--
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.