To be clear, when you do "view source" in the browser, you see:

<a href="http://localhost:8000/web2py_jquery/default/index#null";

I get:

<a href="#null <http://localhost:8000/web2py_jquery/default/index#null>"

and I don't see how web2py could be generating your version. Of course, if 
I hover over the link or actually click it, I do get 
http://localhost:8000/web2py_jquery/default/index#null, as the browser 
ultimately has to resolve the full absolute URL. But the source itself 
includes only "#null".

Here's the relevant code from the A.xml method:

            self['_href'] = self['_href'] or '#null'

So, if no _href attribute is passed to the helper (as in your code), then 
_href gets set to '#null' (otherwise, the _href is used as submitted). Your 
output implies code more like:

            from gluon import current
            self['_href'] = self['_href'] or URL(r=current.request, host=
True) + '/#null'

Anthony

On Friday, August 31, 2012 8:10:49 AM UTC-4, Daniel Gonzalez wrote:
>
> From trunk (github)
>
> On Friday, August 31, 2012 1:24:40 PM UTC+2, Anthony wrote:
>>
>> I cannot reproduce this either. Running the latest trunk, here's the 
>> output I get in the browser:
>>
>> <html> <head>
>> <title></title>
>> </head>
>> <body>
>> <h1>Testing error with URL and A</h1>
>> <div id="me"><a href="#null" onclick="ajax(&#x27;/test/default/mycallback
>> &#x27;,[],&#x27;me&#x27;);return false">click me</a></div>
>> /test/default/mycallback
>> </body>
>> </html>
>>
>> Are you running from source, or the Windows or Mac binary?
>>
>> Anthony
>>
>> On Friday, August 31, 2012 2:13:01 AM UTC-4, Daniel Gonzalez wrote:
>>>
>>> The problem is still there in Version 2.0.3 (2012-08-31 00:31:48) stable
>>> You can reproduce it with the following minimal application:
>>> https://github.com/gonvaled/web2py-tests/tree/master/problem_A_URL
>>>
>>> On Thursday, August 30, 2012 10:13:11 PM UTC+2, Anthony wrote:
>>>>
>>>> I think the issue is not in the onclick but the href. When you set the 
>>>> callback but don't set an explicit href, the A() helper should set href to 
>>>> "#null", but for some reason, his code is appending #null to an actual 
>>>> URL. 
>>>> I can't reproduce that when I run the same code.
>>>>
>>>> Anthony
>>>>
>>>> On Thursday, August 30, 2012 4:03:29 PM UTC-4, Massimo Di Pierro wrote:
>>>>>
>>>>> The quotes are escaped when in between quotes. That is the correct 
>>>>> thing to do for security. It works fine or does it not?
>>>>>
>>>>> On Thursday, 30 August 2012 07:00:25 UTC-5, Daniel Gonzalez wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have the  following markup in an html viewfile:
>>>>>>
>>>>>> {{=DIV(A('click me',callback=URL('mycallback'),target="me"),_id="me"
>>>>>> )}}
>>>>>> {{=URL('mycallback')}}
>>>>>>
>>>>>> Which is producing the following html:
>>>>>>
>>>>>> <div id="me"><a href="
>>>>>> http://localhost:8000/web2py_jquery/default/index#null"; onclick="ajax
>>>>>> (&#39;/web2py_jquery/default/mycallback&#39;,[],&#39;me&#39;);return 
>>>>>> false">click me</a></div>
>>>>>> /web2py_jquery/default/mycallback
>>>>>>
>>>>>> (web2py_jquery is just my test application)
>>>>>>
>>>>>> I do not understand why =URL('callback') is rendering differently 
>>>>>> depending on the context. Specially the "#null" makes me worry
>>>>>> Is this expected?
>>>>>>
>>>>>> Thanks,
>>>>>> Daniel
>>>>>>
>>>>>

-- 



Reply via email to