That s what readonly means. readonly is an HTML attribute and has nothing 
to do with form processing. If you do not want them to appear in forms you 
have to tell the model:

db.owner.own_end_date.writable = False # not writable
db.owner.own_end_date.readable = False # do not show is at all!

Massimo

On Monday, 23 June 2014 00:00:05 UTC-5, 98u...@gmail.com wrote:
>
> Why readonly elements (select and date field) of a form respond to clicks 
> and allow for changes and can be submitted? They look grayed out as if 
> readonly but when I click on date field the date picker appears and works 
> as it shoud also the select option is grayed out but it offers a list to 
> choose an option and the form can be submitted with these changed values 
> even though this is not intended.
> #this is the model
>
> db.define_table('owner',
>                 Field('own_cust_fk','reference customer',label='Customer'),
>                 Field('own_veh_fk','reference vehicle',label='Vehicle'),
>                 Field('own_plate','string',label='Plate'),
>                 Field('own_comment','string',label='Comment'),
>                 Field('own_start_date','date',default=now,label='Start 
> date'),
>                 
> Field('own_end_date','date',default=None,label='Terminated'),
>                 migrate='owner.table',format='%(own_plate)s 
> %(own_cust_fk)s',
>                 plural='Owner'
>                 )
>
>
> def index():
>
>     ...
>     ...
>
>     form = SQLFORM.smartgrid(db.owner,
>                              fields=fields,
>                              headers=headers,
>                              paginate=all,
>                              details=True,
>                              editable=True,
>                              deletable=False,
>                              create=False,
>                              showbuttontext=False,
>                              maxtextlength=40,
>                              maxtextlengths=maxtextlengths,
>                              buttons_placement = 'left',
>                              )
>     ...
>     ...
>
>     if ((len(request.args)>1) and (request.args(1)=='edit')):
>             form.element('select',_name='own_cust_fk')['_readonly']='True'
>             form.element('input',_name='own_end_date')['_readonly']='True'
>     ...
>     ...
>     return dict(form=form)
>
>
>
> Any help would be appreciated!
> Thanks
>

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