Hello (and Happy Thanksgiving)

I've walked through the tutorials about creating a simple model (db table) 
then using the controller and view to automatically generate forms with 
validation.  They are GREAT!

My problem is when I tried to modify the form.

For example, I created a simple model that stores timecard related data.


db.define_table(
    'time_record',
    Field('firstName',requires=IS_NOT_EMPTY() ),
    Field('lastName',requires=IS_NOT_EMPTY() ),
    Field('userId',requires=IS_NOT_EMPTY() ),
    Field('clientCode', requires = IS_INT_IN_RANGE(10,20) ),
    Field('dateOfWork', type='date', requires = IS_DATE() ),
    Field('hours', requires = IS_FLOAT_IN_RANGE(0.1,16.0) )
)

Next, I build the controller:

def create_time_record():
    return dict(form=crud.update(db.time_record,request.args(0)))

Next, I have the view:

{{extend 'layout.html'}}
{{ = form }}

Instead of the user entering the data in the form, I want to set one of the 
form fields to be invisible (or disabled) and automatically get its values 
from the session object from the log in, for 
example, session.auth.user.first_name.  I can easily display auth data (id, 
first_name, last_name) but I cannot set this data into the form.

{{ = form }} is so simple and powerful, yet how to I access a specific form 
element, set its value, and not affect the overall form validation process.

Thank You All!
Terry



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