[web2py] Re: Question about @request.restful

2013-07-25 Thread Franco
currently i'm using this version: 2.4.6-stable+timestamp.2013.04.06.17.37.38


El jueves, 25 de julio de 2013 11:26:07 UTC-3, Niphlod escribió:
>
> ehm? recent web2py should parse application/json POSTs just fine !?!
>
> On Thursday, July 25, 2013 3:07:02 PM UTC+2, Massimo Di Pierro wrote:
>>
>> The problem is that angular sends the request variables as json in body 
>> and not urlencoded (an expected) So you must replace
>>
>> def POST(table_name, **vars):
>> print(vars)
>>
>> with
>>
>> def POST(table_name):
>> vars = json.loads(request.body.read())
>> print(vars)
>>
>> On Tuesday, 23 July 2013 21:37:16 UTC-5, Franco wrote:
>>>
>>> Anybody?
>>>
>>> El domingo, 21 de julio de 2013 14:46:08 UTC-3, Franco escribió:
>>>>
>>>> Greetings everyone,
>>>> I've been using request.restful
>>>> to provide an restful interface to my angularjs app,
>>>> i tried to post data from the angularjs app and it works, it sends the 
>>>> data but in the POST method i've got an empty dictionary, here is my code 
>>>> and some data logs:
>>>>
>>>> default controller
>>>> @request.restful()
>>>> def api():
>>>> response.view = 'generic.json'
>>>> def GET(table_name, id=None):
>>>> if table_name in db:
>>>> table = db[table_name]
>>>> if id == None:
>>>> query = (table.id > 0)
>>>> else:
>>>> try:
>>>> id = int(id or 0)
>>>> except:
>>>> id = 0
>>>> query = (table.id == id)
>>>> return {table_name : db(query).select()}
>>>> def POST(table_name, **vars):
>>>> print(vars)
>>>> return locals()
>>>>
>>>> angular code used to post data:
>>>> $http.post('http://127.0.0.1:8000/angularjs/default/api/person/', item
>>>> ).success(function(data) {
>>>> console.log('POST: '+ item.first_name +' Result: '+ data);
>>>> });
>>>>
>>>> chrome network log:
>>>>
>>>>>
>>>>>1. Request URL:
>>>>>http://127.0.0.1:8000/angularjs/default/api/person/
>>>>>2. Request Method:
>>>>>POST
>>>>>3. Status Code:
>>>>>200 OK
>>>>>4. Request Headersview source
>>>>>   1. Accept:
>>>>>   application/json, text/plain, */*
>>>>>   2. Accept-Encoding:
>>>>>   gzip,deflate,sdch
>>>>>   3. Accept-Language:
>>>>>   es,en-US;q=0.8,en;q=0.6
>>>>>   4. Connection:
>>>>>   keep-alive
>>>>>   5. Content-Length:
>>>>>   46
>>>>>   6. Content-Type:
>>>>>   application/json;charset=UTF-8
>>>>>   7. Cookie:
>>>>>   csrftoken=hMi7rvIHaxAu09tX0H8c2SDqmwwgS7Ra; 
>>>>>   session_id_admin=127.0.0.1-9ef67e29-1352-4fef-a621-fcc0c3fa9182; 
>>>>>   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316
>>>>>   8. Host:
>>>>>   127.0.0.1:8000
>>>>>   9. Origin:
>>>>>   http://127.0.0.1:8000
>>>>>   10. Referer:
>>>>>   http://127.0.0.1:8000/angularjs/default/index
>>>>>   11. User-Agent:
>>>>>   Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, 
>>>>>   like Gecko) Chrome/28.0.1500.72 Safari/537.36
>>>>>   5. Request Payloadview source
>>>>>{id:0, first_name:John, last_name:Doe}
>>>>>1. first_name: "John"
>>>>>   2. id: 0
>>>>>   3. last_name: "Doe"
>>>>>6. Response Headersview source
>>>>>   1. Cache-Control:
>>>>>   no-store, no-cache, must-revalidate, post-check=0, pre-check=0
>>>>>   2. Connection:
>>>>>   keep-alive
>>>>>   3. Content-Length:
>>>>>   4
>>>>>   4. Content-Type:
>>>>>   text/html; charset=utf-8
>>>>>   5. Date:
>>>>>   Sun, 21 Jul 2013 17:38:41 GMT
>>>>>   6. Expires:
>>>>>   Sun, 21 Jul 2013 17:38:41 GMT
>>>>>   7. Pragma:
>>>>>   no-cache
>>>>>   8. Server:
>>>>>   Rocket 1.2.6 Python/2.7.5
>>>>>   9. Set-Cookie:
>>>>>   
>>>>> session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316; 
>>>>>   Path=/
>>>>>   10. X-Powered-By:
>>>>>   web2py
>>>>>   
>>>>>
>>>> I made some tests using the "requests" module and it works, so for 
>>>> instance i think that the problem is within the way that angularjs sends 
>>>> the data.
>>>>
>>>> Thanks in advance,
>>>>
>>>> Franco
>>>>
>>>>>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Question about @request.restful

2013-07-25 Thread Franco
thanks, that's right! now it works. Thanks for the hint ;-)

El jueves, 25 de julio de 2013 10:07:02 UTC-3, Massimo Di Pierro escribió:
>
> The problem is that angular sends the request variables as json in body 
> and not urlencoded (an expected) So you must replace
>
> def POST(table_name, **vars):
> print(vars)
>
> with
>
> def POST(table_name):
> vars = json.loads(request.body.read())
> print(vars)
>
> On Tuesday, 23 July 2013 21:37:16 UTC-5, Franco wrote:
>>
>> Anybody?
>>
>> El domingo, 21 de julio de 2013 14:46:08 UTC-3, Franco escribió:
>>>
>>> Greetings everyone,
>>> I've been using request.restful
>>> to provide an restful interface to my angularjs app,
>>> i tried to post data from the angularjs app and it works, it sends the 
>>> data but in the POST method i've got an empty dictionary, here is my code 
>>> and some data logs:
>>>
>>> default controller
>>> @request.restful()
>>> def api():
>>> response.view = 'generic.json'
>>> def GET(table_name, id=None):
>>> if table_name in db:
>>> table = db[table_name]
>>> if id == None:
>>> query = (table.id > 0)
>>> else:
>>> try:
>>> id = int(id or 0)
>>> except:
>>> id = 0
>>> query = (table.id == id)
>>> return {table_name : db(query).select()}
>>> def POST(table_name, **vars):
>>> print(vars)
>>> return locals()
>>>
>>> angular code used to post data:
>>> $http.post('http://127.0.0.1:8000/angularjs/default/api/person/', item).
>>> success(function(data) {
>>> console.log('POST: '+ item.first_name +' Result: '+ data);
>>> });
>>>
>>> chrome network log:
>>>
>>>>
>>>>1. Request URL:
>>>>http://127.0.0.1:8000/angularjs/default/api/person/
>>>>2. Request Method:
>>>>POST
>>>>3. Status Code:
>>>>200 OK
>>>>4. Request Headersview source
>>>>   1. Accept:
>>>>   application/json, text/plain, */*
>>>>   2. Accept-Encoding:
>>>>   gzip,deflate,sdch
>>>>   3. Accept-Language:
>>>>   es,en-US;q=0.8,en;q=0.6
>>>>   4. Connection:
>>>>   keep-alive
>>>>   5. Content-Length:
>>>>   46
>>>>   6. Content-Type:
>>>>   application/json;charset=UTF-8
>>>>   7. Cookie:
>>>>   csrftoken=hMi7rvIHaxAu09tX0H8c2SDqmwwgS7Ra; 
>>>>   session_id_admin=127.0.0.1-9ef67e29-1352-4fef-a621-fcc0c3fa9182; 
>>>>   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316
>>>>   8. Host:
>>>>   127.0.0.1:8000
>>>>   9. Origin:
>>>>   http://127.0.0.1:8000
>>>>   10. Referer:
>>>>   http://127.0.0.1:8000/angularjs/default/index
>>>>   11. User-Agent:
>>>>   Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, 
>>>>   like Gecko) Chrome/28.0.1500.72 Safari/537.36
>>>>   5. Request Payloadview source
>>>>{id:0, first_name:John, last_name:Doe}
>>>>1. first_name: "John"
>>>>   2. id: 0
>>>>   3. last_name: "Doe"
>>>>6. Response Headersview source
>>>>   1. Cache-Control:
>>>>   no-store, no-cache, must-revalidate, post-check=0, pre-check=0
>>>>   2. Connection:
>>>>   keep-alive
>>>>   3. Content-Length:
>>>>   4
>>>>   4. Content-Type:
>>>>   text/html; charset=utf-8
>>>>   5. Date:
>>>>   Sun, 21 Jul 2013 17:38:41 GMT
>>>>   6. Expires:
>>>>   Sun, 21 Jul 2013 17:38:41 GMT
>>>>   7. Pragma:
>>>>   no-cache
>>>>   8. Server:
>>>>   Rocket 1.2.6 Python/2.7.5
>>>>   9. Set-Cookie:
>>>>   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316; 
>>>>   Path=/
>>>>   10. X-Powered-By:
>>>>   web2py
>>>>   
>>>>
>>> I made some tests using the "requests" module and it works, so for 
>>> instance i think that the problem is within the way that angularjs sends 
>>> the data.
>>>
>>> Thanks in advance,
>>>
>>> Franco
>>>
>>>>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Question about @request.restful

2013-07-23 Thread Franco
Anybody?

El domingo, 21 de julio de 2013 14:46:08 UTC-3, Franco escribió:
>
> Greetings everyone,
> I've been using request.restful
> to provide an restful interface to my angularjs app,
> i tried to post data from the angularjs app and it works, it sends the 
> data but in the POST method i've got an empty dictionary, here is my code 
> and some data logs:
>
> default controller
> @request.restful()
> def api():
> response.view = 'generic.json'
> def GET(table_name, id=None):
> if table_name in db:
> table = db[table_name]
> if id == None:
> query = (table.id > 0)
> else:
> try:
> id = int(id or 0)
> except:
> id = 0
> query = (table.id == id)
> return {table_name : db(query).select()}
> def POST(table_name, **vars):
> print(vars)
> return locals()
>
> angular code used to post data:
> $http.post('http://127.0.0.1:8000/angularjs/default/api/person/', item).
> success(function(data) {
> console.log('POST: '+ item.first_name +' Result: '+ data);
> });
>
> chrome network log:
>
>>
>>1. Request URL:
>>http://127.0.0.1:8000/angularjs/default/api/person/
>>2. Request Method:
>>POST
>>3. Status Code:
>>200 OK
>>4. Request Headersview source
>>   1. Accept:
>>   application/json, text/plain, */*
>>   2. Accept-Encoding:
>>   gzip,deflate,sdch
>>   3. Accept-Language:
>>   es,en-US;q=0.8,en;q=0.6
>>   4. Connection:
>>   keep-alive
>>   5. Content-Length:
>>   46
>>   6. Content-Type:
>>   application/json;charset=UTF-8
>>   7. Cookie:
>>   csrftoken=hMi7rvIHaxAu09tX0H8c2SDqmwwgS7Ra; 
>>   session_id_admin=127.0.0.1-9ef67e29-1352-4fef-a621-fcc0c3fa9182; 
>>   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316
>>   8. Host:
>>   127.0.0.1:8000
>>   9. Origin:
>>   http://127.0.0.1:8000
>>   10. Referer:
>>   http://127.0.0.1:8000/angularjs/default/index
>>   11. User-Agent:
>>   Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, 
>>   like Gecko) Chrome/28.0.1500.72 Safari/537.36
>>   5. Request Payloadview source
>>{id:0, first_name:John, last_name:Doe}
>>1. first_name: "John"
>>   2. id: 0
>>   3. last_name: "Doe"
>>6. Response Headersview source
>>   1. Cache-Control:
>>   no-store, no-cache, must-revalidate, post-check=0, pre-check=0
>>   2. Connection:
>>   keep-alive
>>   3. Content-Length:
>>   4
>>   4. Content-Type:
>>   text/html; charset=utf-8
>>   5. Date:
>>   Sun, 21 Jul 2013 17:38:41 GMT
>>   6. Expires:
>>   Sun, 21 Jul 2013 17:38:41 GMT
>>   7. Pragma:
>>   no-cache
>>   8. Server:
>>   Rocket 1.2.6 Python/2.7.5
>>   9. Set-Cookie:
>>   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316; 
>>   Path=/
>>   10. X-Powered-By:
>>   web2py
>>   
>>
> I made some tests using the "requests" module and it works, so for 
> instance i think that the problem is within the way that angularjs sends 
> the data.
>
> Thanks in advance,
>
> Franco
>
>>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Question about @request.restful

2013-07-21 Thread Franco
Greetings everyone,
I've been using request.restful
to provide an restful interface to my angularjs app,
i tried to post data from the angularjs app and it works, it sends the data 
but in the POST method i've got an empty dictionary, here is my code and 
some data logs:

default controller
@request.restful()
def api():
response.view = 'generic.json'
def GET(table_name, id=None):
if table_name in db:
table = db[table_name]
if id == None:
query = (table.id > 0)
else:
try:
id = int(id or 0)
except:
id = 0
query = (table.id == id)
return {table_name : db(query).select()}
def POST(table_name, **vars):
print(vars)
return locals()

angular code used to post data:
$http.post('http://127.0.0.1:8000/angularjs/default/api/person/', item).
success(function(data) {
console.log('POST: '+ item.first_name +' Result: '+ data);
});

chrome network log:

>
>1. Request URL:
>http://127.0.0.1:8000/angularjs/default/api/person/
>2. Request Method:
>POST
>3. Status Code:
>200 OK
>4. Request Headersview source
>   1. Accept:
>   application/json, text/plain, */*
>   2. Accept-Encoding:
>   gzip,deflate,sdch
>   3. Accept-Language:
>   es,en-US;q=0.8,en;q=0.6
>   4. Connection:
>   keep-alive
>   5. Content-Length:
>   46
>   6. Content-Type:
>   application/json;charset=UTF-8
>   7. Cookie:
>   csrftoken=hMi7rvIHaxAu09tX0H8c2SDqmwwgS7Ra; 
>   session_id_admin=127.0.0.1-9ef67e29-1352-4fef-a621-fcc0c3fa9182; 
>   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316
>   8. Host:
>   127.0.0.1:8000
>   9. Origin:
>   http://127.0.0.1:8000
>   10. Referer:
>   http://127.0.0.1:8000/angularjs/default/index
>   11. User-Agent:
>   Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like 
>   Gecko) Chrome/28.0.1500.72 Safari/537.36
>   5. Request Payloadview source
>{id:0, first_name:John, last_name:Doe}
>1. first_name: "John"
>   2. id: 0
>   3. last_name: "Doe"
>6. Response Headersview source
>   1. Cache-Control:
>   no-store, no-cache, must-revalidate, post-check=0, pre-check=0
>   2. Connection:
>   keep-alive
>   3. Content-Length:
>   4
>   4. Content-Type:
>   text/html; charset=utf-8
>   5. Date:
>   Sun, 21 Jul 2013 17:38:41 GMT
>   6. Expires:
>   Sun, 21 Jul 2013 17:38:41 GMT
>   7. Pragma:
>   no-cache
>   8. Server:
>   Rocket 1.2.6 Python/2.7.5
>   9. Set-Cookie:
>   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316; 
>   Path=/
>   10. X-Powered-By:
>   web2py
>   
>
I made some tests using the "requests" module and it works, so for instance 
i think that the problem is within the way that angularjs sends the data.

Thanks in advance,

Franco

>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: New Plugin to add client side validation to your SQLFORM

2012-09-23 Thread Franco Alarcon
If you need some help, i'm glad to help you.

2012/9/22 Massimo Di Pierro 

> This is really a good idea. I will try it asap. Join us on
> web2py-developers.
>
>
> On Tuesday, 24 July 2012 09:38:51 UTC-5, Franco wrote:
>>
>>
>> <https://lh6.googleusercontent.com/-ICahDjG44ak/UA6u1Az37FI/AFc/YVBbufNi1q8/s1600/screen.png>
>>
>> Greetings everyone. I want to share with you this plugin, it's based on
>> jquery-validation-engine plugin.
>>
>> It's easy to use, your only need to replace SQLFORM with JsSQLFORM and
>> that's it.
>>
>> At this moment only supports 7 validators (IS_NOT_EMPTY, IS_EMAIL, IS_**
>> URL, IS_DATE, IS_LENGTH, IS_**INT_IN_RANGE, IS_FLOAT_IN_**RANGE).
>>
>>
>> Here are some examples of use:
>> def validation():
>>
>>
>>
>> from plugin_ValidationEngine import JsSQLFORM
>>
>> f = JsSQLFORM.factory(
>>
>> Field('nombre', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3)],label
>> = 'Nombre'),
>>
>> Field('apellido', requires = IS_NOT_EMPTY(), label = 'Apellido'),
>>
>> Field('cuit', requires = IS_LENGTH(12, 12), label = 'Cuit'),
>>
>> Field('edad', requires = IS_INT_IN_RANGE(18, 65), label = 'Edad'
>> ),
>>
>> Field('importe', requires = IS_FLOAT_IN_RANGE(1, .99), label
>> = 'Importe')
>>
>> )
>>
>> if f.accepts(request, session):
>>
>> response.flash = 'Ok'
>>
>> else:
>>
>> response.flash = 'Bad'
>>
>> return dict(form = f)
>>
>>
>>
>>
>> def validation2():
>>
>> from plugin_ValidationEngine import JsSQLFORM
>>
>> f = JsSQLFORM(db.test)
>>
>> if f.accepts(request, session):
>>
>> response.flash = 'Ok'
>>
>> else:
>>
>> response.flash = 'Bad'
>>
>> return dict(form = f)
>>
>>
>>
>>
>>
>>
>>
>>  --
>
>
>
>



-- 
*Franco Andrés Alarcón*

-- 





[web2py] I need help to setup the domain...

2012-09-18 Thread Franco
Hello everyone, I need your help!! I don't know how to configure the domain 
in the routes.py.
Which is the regular expression that i need to change this:
*http:///application/controller/function *
To that:
*http:///application/controller/function* ?

Thanks in advance.

-- 





Re: [web2py] Re: client-side validation plugin

2012-08-16 Thread Franco
Try with this version. I need to warning you the python regex are different 
of javascript regex, so it could be problematic depending of the regex that 
you use.

El miércoles, 15 de agosto de 2012 00:37:35 UTC-3, Alec Taylor escribió:
>
> Thanks a heap Franco :)
>
> The only suggestion I have is to add the `IS_MATCH` validator
>
> On Wed, Aug 15, 2012 at 11:12 AM, Franco 
> > wrote:
>
>> Ups, I made a double post. Anyway if there are any interested, here is an 
>> example of use:
>>
>> def validation():
>>
>>
>>
>> from plugin_ValidationEngine import JsSQLFORM
>>
>> f = JsSQLFORM.factory(
>>
>> Field('first_name', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3
>> )], label = 'First Name'),
>>
>> Field('last_name', requires = IS_NOT_EMPTY(), label = 'Last Name'
>> ),
>>
>> Field('id', requires = IS_LENGTH(12, 12), label = 'Id'),
>>
>> Field('age', requires = IS_INT_IN_RANGE(18, 65), label = 'Age'),
>>
>> Field('amount', requires = IS_FLOAT_IN_RANGE(1, .99), label = 
>> 'Amount')
>>
>> )
>>
>> if f.accepts(request, session):
>>
>> response.flash = 'Ok'
>>
>> else:
>>
>> response.flash = 'Bad'
>>
>> return dict(form = f)
>>
>>
>>
>>
>> def validation2():
>>
>> from plugin_ValidationEngine import JsSQLFORM
>>
>> f = JsSQLFORM(db.test)
>>
>> if f.accepts(request, session):
>>
>> response.flash = 'Ok'
>>
>> else:
>>
>> response.flash = 'Bad'
>>
>> return dict(form = f)
>>
>> Until now i implemented 7 validators (IS_NOT_EMPTY, IS_EMAIL, IS_**
>> URL, IS_DATE, IS_LENGTH, IS_**INT_IN_RANGE, IS_FLOAT_IN_**RANGE).
>>
>> I hear suggestions.
>>
>>
>>
>> El lunes, 23 de julio de 2012 17:36:39 UTC-3, Franco escribió:
>>
>>> Greetings everyone, I want to share with you a plugin that adds client 
>>> side validation to your forms. I hope this be helpful to you.
>>>
>>> It uses in the same way that you use SQLFORM class.
>>>
>>>
>>> See you soon.
>>>
>>> PS: Sorry for my bad english.
>>>
>>>
>>> <https://lh3.googleusercontent.com/-koqpaOGhCvM/UA21w2sGAxI/AFQ/zE2h4FPnXi4/s1600/screen.png>
>>>
>>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





web2py.plugin.ValidationEngine.w2p
Description: Binary data


[web2py] Re: client-side validation plugin

2012-08-14 Thread Franco
Ups, I made a double post. Anyway if there are any interested, here is an 
example of use:

def validation():



from plugin_ValidationEngine import JsSQLFORM

f = JsSQLFORM.factory(

Field('first_name', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3)],label 
= 'First Name'),

Field('last_name', requires = IS_NOT_EMPTY(), label = 'Last Name'),

Field('id', requires = IS_LENGTH(12, 12), label = 'Id'),

Field('age', requires = IS_INT_IN_RANGE(18, 65), label = 'Age'),

Field('amount', requires = IS_FLOAT_IN_RANGE(1, .99), label = 
'Amount')

)

if f.accepts(request, session):

response.flash = 'Ok'

else:

response.flash = 'Bad'

return dict(form = f)




def validation2():

from plugin_ValidationEngine import JsSQLFORM

f = JsSQLFORM(db.test)

if f.accepts(request, session):

response.flash = 'Ok'

else:

response.flash = 'Bad'

return dict(form = f)

Until now i implemented 7 validators 
(IS_NOT_EMPTY, IS_EMAIL, IS_URL, IS_DATE, IS_LENGTH, IS_INT_IN_RANGE, 
IS_FLOAT_IN_RANGE).

I hear suggestions.



El lunes, 23 de julio de 2012 17:36:39 UTC-3, Franco escribió:
>
> Greetings everyone, I want to share with you a plugin that adds client 
> side validation to your forms. I hope this be helpful to you.
>
> It uses in the same way that you use SQLFORM class.
>
>
> See you soon.
>
> PS: Sorry for my bad english.
>
>
> <https://lh3.googleusercontent.com/-koqpaOGhCvM/UA21w2sGAxI/AFQ/zE2h4FPnXi4/s1600/screen.png>
>
>

-- 





[web2py] Re: New Plugin to add client side validation to your SQLFORM

2012-08-04 Thread Franco
Sorry for the delayed response.
Basically overrides SQLFORM default widgets with my own widgets.
That's all, sorry if my explanation is shallow, but i don't know how to 
explain me in english.
The sourcecode is quite simple maybe another example could help?

El martes, 24 de julio de 2012 15:44:55 UTC-3, Massimo Di Pierro escribió:
>
> Can you tell us more about how it works?
>
> On Tuesday, 24 July 2012 09:38:51 UTC-5, Franco wrote:
>>
>>
>> <https://lh6.googleusercontent.com/-ICahDjG44ak/UA6u1Az37FI/AFc/YVBbufNi1q8/s1600/screen.png>
>>
>> Greetings everyone. I want to share with you this plugin, it's based on 
>> jquery-validation-engine plugin.
>>
>> It's easy to use, your only need to replace SQLFORM with JsSQLFORM and 
>> that's it.
>>
>> At this moment only supports 7 validators 
>> (IS_NOT_EMPTY, IS_EMAIL, IS_URL, IS_DATE, IS_LENGTH, IS_INT_IN_RANGE, 
>> IS_FLOAT_IN_RANGE).
>>
>>
>> Here are some examples of use:
>> def validation():
>>
>>
>>
>> from plugin_ValidationEngine import JsSQLFORM
>>
>> f = JsSQLFORM.factory(
>>
>> Field('nombre', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3)],label 
>> = 'Nombre'),
>>
>> Field('apellido', requires = IS_NOT_EMPTY(), label = 'Apellido'),
>>
>> Field('cuit', requires = IS_LENGTH(12, 12), label = 'Cuit'),
>>
>> Field('edad', requires = IS_INT_IN_RANGE(18, 65), label = 'Edad'
>> ),
>>
>> Field('importe', requires = IS_FLOAT_IN_RANGE(1, .99), label 
>> = 'Importe')
>>
>> )
>>
>> if f.accepts(request, session):
>>
>> response.flash = 'Ok'
>>
>> else:
>>
>> response.flash = 'Bad'
>>
>> return dict(form = f)
>>
>>
>>
>>
>> def validation2():
>>
>> from plugin_ValidationEngine import JsSQLFORM
>>
>> f = JsSQLFORM(db.test)
>>
>> if f.accepts(request, session):
>>
>> response.flash = 'Ok'
>>
>> else:
>>
>> response.flash = 'Bad'
>>
>> return dict(form = f)
>>
>>
>>
>>
>>
>>
>>
>>

-- 





[web2py] New Plugin to add client side validation to your SQLFORM

2012-07-24 Thread Franco




Greetings everyone. I want to share with you this plugin, it's based on 
jquery-validation-engine plugin.

It's easy to use, your only need to replace SQLFORM with JsSQLFORM and 
that's it.

At this moment only supports 7 validators 
(IS_NOT_EMPTY, IS_EMAIL, IS_URL, IS_DATE, IS_LENGTH, IS_INT_IN_RANGE, 
IS_FLOAT_IN_RANGE).


Here are some examples of use:
def validation():



from plugin_ValidationEngine import JsSQLFORM

f = JsSQLFORM.factory(

Field('nombre', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3)],label 
= 'Nombre'),

Field('apellido', requires = IS_NOT_EMPTY(), label = 'Apellido'),

Field('cuit', requires = IS_LENGTH(12, 12), label = 'Cuit'),

Field('edad', requires = IS_INT_IN_RANGE(18, 65), label = 'Edad'),

Field('importe', requires = IS_FLOAT_IN_RANGE(1, .99), label = 
'Importe')

)

if f.accepts(request, session):

response.flash = 'Ok'

else:

response.flash = 'Bad'

return dict(form = f)




def validation2():

from plugin_ValidationEngine import JsSQLFORM

f = JsSQLFORM(db.test)

if f.accepts(request, session):

response.flash = 'Ok'

else:

response.flash = 'Bad'

return dict(form = f)







-- 





web2py.plugin.ValidationEngine.w2p
Description: Binary data


[web2py] client-side validation plugin

2012-07-24 Thread Franco
Greetings everyone, I want to share with you a plugin that adds client side 
validation to your forms. I hope this be helpful to you.

It uses in the same way that you use SQLFORM class.


See you soon.

PS: Sorry for my bad english.



-- 





web2py.plugin.ValidationEngine.w2p
Description: Binary data