Hi,
Your suggestion was not enouth, still not running, but, I used the idea and
studied more and got the solution.
repr(x.decode('utf-8)').encode('latin_1'))
where x=session.cep['logradouro']
Thanks a lot your helping.
Best regards
Em sexta-feira, 27 de janeiro de 2017 19:36:24 UTC-2, Val K escreveu:
>
> str() - doesn't work with uincode - try
> unicode(session.cep['logradouro']) or unicode(session.cep['logradouro'],
> 'utf-8')
>
> On Friday, January 27, 2017 at 11:51:49 PM UTC+3, Morganti wrote:
>>
>> Hi,
>>
>> I just using web2py book.
>>
>> Using that example jQuery and Ajax am getting the population of the
>> fields. I changed all code above sent. But, now, I am having problems with
>> utf-8. I mean, when I received any data with special character like 'á' or
>> 'ç', the data is not putting in the field
>>
>> The code is like:
>>
>> jQuery('#auth_user_cep').blur(function(){
>> ajax('{{=URL('cadastro', 'preenche_cep')}}', ['cep'], ':eval');
>> });
>>
>> and the controller sending like
>>
>> return "jQuery('#auth_user_endereco').val(%s);" %
>> repr(str(session.cep['logradouro']))
>>
>> When the session.cep['logradouro']) there is no special character
>> (utf-8), ok! It´s running, but, when utf-8 is presented, nothing.
>>
>> I tried to use string.decode('utf-8') and sting not running.
>>
>> I almost getting it.
>>
>> Thanks a lot your supporting.
>> Best regards
>> André
>>
>>
>> Em sexta-feira, 27 de janeiro de 2017 18:00:57 UTC-2, Val K escreveu:
>>>
>>> you do an *ajax *request and *immediately * try to use ajax-results
>>> look for $.ajax() in jQuery docs
>>>
>>> On Friday, January 27, 2017 at 5:48:59 PM UTC+3, Morganti wrote:
>>>>
>>>> Hi guys,
>>>>
>>>> I have some extra felds no auth_user. I need to complete some fields
>>>> after one filled in.
>>>>
>>>> I am able to read this field using jquery..blur and using ajax to
>>>> collect these fields from a external webservice and putting the results on
>>>> hidden div and input fiedls. Now I need to use these input fields to fill
>>>> the correct fields
>>>>
>>>
>>>> I am using the commands:
>>>>
>>>> <script type="text/javascript">
>>>> jQuery(document).ready(function(){
>>>> jQuery('#auth_user_cep').blur(function(){
>>>> ajax('{{=URL('cadastro', 'preenche_cep')}}', ['cep'],
>>>> 'preenchecep');
>>>> jQuery('#auth_user_endereco').val(jQuery('#pendereco').val());
>>>> jQuery('#auth_user_bairro').val(jQuery('#pbairro').val());
>>>> jQuery('#auth_user_cidade').val(jQuery('#pcidade').val());
>>>> });
>>>> });
>>>> </script>
>>>>
>>>> But the auth_user fields are not being changed. If I try to execute on
>>>> console of browser, I can change them. But, by using the scricpt, no!
>>>>
>>>> Can you give some directions?
>>>>
>>>> Thanks a lot your helping.
>>>> BR
>>>> André
>>>>
>>>
--
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.