Question about validators.py and new Form.py

45 views
Skip to first unread message

Richard

unread,
Mar 21, 2016, 3:20:12 PM3/21/16
to web2py-developers
Hello Massimo,

You mention that validators was a good piece of web2py, but they will fit into new Form.py... Do they will serve as server side validation and have their counter part in ractive js ?

Thanks

Richard

Massimo DiPierro

unread,
Mar 21, 2016, 3:22:50 PM3/21/16
to web2py-d...@googlegroups.com
Now using ractive in form.py. Form.py is just a rewrite of sqlform with the ability to communicate in json. Nothing really changes other than you do

form = Form(db.table)
if form.accepted: ...

instead of

form =  SQLFORM(db.table).process()
if form.accepted: ….

and if the form is not embedded in view {{=form}} it is not serialized in HTML.

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Richard Vézina

unread,
Mar 21, 2016, 3:28:39 PM3/21/16
to web2py-d...@googlegroups.com
Yeah I had a look at the code... I was confused by your w3 effort : https://github.com/mdipierro/w3

I think my question is more how both gonna play together or are we going to have both option in "web3py"?

I know there is many things to figure out like a structured json between client side form and web2py...

Richard

Leonel Câmara

unread,
Mar 21, 2016, 3:30:34 PM3/21/16
to web2py-developers
Also take note that, whether we provide javascript validators or not. I'm not sure if we should myself as I think that's best left to whatever javascript library the users like to use or even to widget plugins. The form's input, any input really, will still need to be validated server side. input that is not validated is the root of all evil.

These validators are also pretty much independent of what you choose to make the form with. The DAL will call them himself if you use methods like validate_and_insert. 

Massimo DiPierro

unread,
Mar 21, 2016, 3:40:35 PM3/21/16
to web2py-d...@googlegroups.com
form.py and web3py are separate things. form.py is a just a better sqlform with sligtly different apis. It will work on both web2py and web3py (when we figure out what it is). form.py uses the same serverside validators and the same clientside validators we have now but I am creating a whole new set of client side widgets that I think should replace the current ones http://mdipierro.github.io/stupid.css/widgets/index.html (they do not require stupid.css). The do partial client-side validation. 

Richard Vézina

unread,
Mar 21, 2016, 4:25:23 PM3/21/16
to web2py-d...@googlegroups.com
Right so actual widget are going to be replaced by client side ones (all?)

Richard

On Mon, Mar 21, 2016 at 3:40 PM, Massimo DiPierro <massimo....@gmail.com> wrote:
form.py and web3py are separate things. form.py is a just a better sqlform with sligtly different apis. It will work on both web2py and web3py (when we figure out what it is). form.py uses the same serverside validators and the same clientside validators we have now but I am creating a whole new set of client side widgets that I think should replace the current ones http://mdipierro.github.io/stupid.css/widgets/index.html (they do not require stupid.css). The do partial client-side validation. 

--

Massimo DiPierro

unread,
Mar 21, 2016, 5:47:35 PM3/21/16
to web2py-d...@googlegroups.com

There are no client-side widgets. other the ones we have now, a new calendar, and new logic for list:type fields and autocomplete. Still thinking about the best way to deal with some of these.

There will be an option to have client side forms but that is v2.

Massimo


On Mar 21, 2016, at 2:30 PM, Leonel Câmara <leonel...@gmail.com> wrote:

Also take note that, whether we provide javascript validators or not. I'm not sure if we should myself as I think that's best left to whatever javascript library the users like to use or even to widget plugins. The form's input, any input really, will still need to be validated server side. input that is not validated is the root of all evil.

These validators are also pretty much independent of what you choose to make the form with. The DAL will call them himself if you use methods like validate_and_insert. 

Richard Vézina

unread,
Mar 22, 2016, 10:10:46 AM3/22/16
to web2py-d...@googlegroups.com
Thanks... I know it was there, I will take time to study it.
Reply all
Reply to author
Forward
0 new messages