SQLFORM shows the values of non-writable fields but does not put those 
values into HTML form widgets, so they are not submitted with the form. A 
couple of options:

   - Instead of setting writable=False, specify a custom widget for the 
   fields with the HTML readonly attribute set to true (e.g., widget=lambda 
   f, v: SQLFORM.widgets.string.widget(f, v, _readonly=True)). With this 
   approach, be sure to validate the non-writable values as well, as a 
   malicious user can still submit modified values.
   - Create a separate object (e.g., a DAL Row) containing the non-writable 
   field values, and make that object available within the onvalidation 
   function (since those values are not changeable within the form, there is 
   no reason the values must come from the form submission).

Anthony

On Wednesday, May 30, 2018 at 4:28:01 PM UTC-4, Andrea Fae' wrote:
>
> Hello I have a SQLFORM but some of them I populate from other variables 
> and I don't want to change. So I typed field.writable=False...
> But when I use a custom "onvalidation" function I want to have the content 
> of all the form fields...
> In request.vars I see some fields but not all
> In form.vars I see part of these fields
> Both without the not writable fields.
>
> How is working? request.vars, form.vars. Why do they show different field 
> values? Why I can't see the not wirtable values? I tried to read the book, 
> but I didn't find the information yet.
> Thanks a lot
>

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

Reply via email to