Yes, really !
Means that if there is not full URL(), web2py creates the url for ajax
request from current page url and if request.args are in use, web2py will
make bad address. There is one points to make it more clear:
- why web2py creates as bad address just the address of the whole page (not
using the requested function name 'echo' at all) - which leads to result
that the page will display twice.
So maybe this behaviour of web2py could be improved.
However this is really proper solution. Thanks! It could be nice update the
manual example here, because many people will fall into same problems. (If
current web2py version still behaves so.)
Dne čtvrtek, 6. února 2014 18:21:27 UTC+1 Anthony napsal(a):
>
> The ajax() function must take a proper URL as the first argument. Your URL
> is just 'echo', which the browser interprets as being relative to the
> current page (because it doesn't start with a '/'). Instead, should be:
>
> ajax('{{=URL('poptavka', 'echo')}}', [], 'target')
>
> which will produce:
>
> ajax('/yourapp/poptavka/echo', [], 'target')
>
> Anthony
>
> On Thursday, February 6, 2014 11:56:25 AM UTC-5, Mirek Zvolský wrote:
>>
>> Hi,
>>
>> >>>>>>>>>> I will see all form controls twice, in the 2nd case inside of
>> the target <span id='target'></span> where I wait the ajax() value.
>> <<<<<<<<<<<<<<<<<<<
>>
>> I work with Web2py 2.5.1 (I'm sorry).
>> Can somebody make me sure, we have no longer following strange behavior
>> in newer versions?
>> So if somebody can copy the controller and view provided bellow in the
>> current version and try call application/poptavka/poptavka/1 and then go
>> into textbox, fill something and move outside.
>> If fixed already, any idea, how to patch 2.5.1?
>>
>> When I navigate to:
>> controller/function
>> all works well,
>>
>> but when I navigate to:
>> controller/function/1
>> >>>>>>>>>> I will see all form controls twice, in the 2nd case inside of
>> the target <span id='target'></span> where I wait the ajax() value.
>> <<<<<<<<<<<<<<<<<<<
>>
>> In other words: ajax() function will render and return the complete html
>> page layout - instead of simple string.
>>
>> My code:
>> model - nothing - I have removed all completly and problem is still here
>> controller poptavka.py
>> def poptavka():
>> form = SQLFORM.factory(
>> Field('fld', 'string'),
>> )
>> return dict(form=form)
>> def echo():
>> return 'aaa'
>> view poptavka/poptavka.html
>> {{extend 'layout.html'}}
>> {{=form}}
>> <span id="target"></span>
>> <script>
>> $(document).ready(function() {
>> $('#no_table_fld').change(function(){
>> ajax('echo', [], 'target');
>> });
>> });
>> </script>
>>
>>
--
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/groups/opt_out.