On Thursday, April 26, 2018 at 4:23:02 PM UTC-4, Alfonso Serra wrote:
>
>
> I'm not sure about this. We already have default validators in place when 
>> using SQLFORM with a DAL table. This breaks down when using SQLFORM.factory 
>> because DAL(None) does not generate the default validators -- but it would 
>> probably be a better approach to change that behavior so that DAL(None) 
>> does get the default validators. That approach would have more general 
>> utility beyond helping with SQLFORM.factory, and it would avoid having to 
>> add complexity/duplicate validation code to the FORM class. In other words, 
>> let's use a mechanism we already have rather than add more code to the 
>> framework.
>>  
>>
> I havent seen where this happens yet, ill have a look. Agree that it will 
> better to reuse the code but, please correct me if im wrong, validators 
> will only trigger if the form is rendered into a view as they lie into the 
> form's components? 
>

No, validation happens within the controller -- it only depends on the form 
object in the controller and the submitted request vars.

We really don't want to try to replicate validation logic directly in the 
form methods -- you would not only need to validate the data but also 
provide a way to specify error messages as with the validators. It would be 
a big unnecessary mess.
 

> About the id field, i thought it didnt make sense to add it as it does not 
> serve any purpose when the form has a NullAdapter. Would be easier to 
> create custom html without having to pop the field.
>

Why do you have to pop 'id' from form.fields? Your code runs fine without 
doing that?

Anthony

-- 
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.

Reply via email to