Ah yes both readable and writable have to be defined. Thanks again
On Mon, Jun 24, 2013 at 6:12 PM, Anthony <abasta...@gmail.com> wrote: > Try writable=False. > > > On Monday, June 24, 2013 6:04:43 PM UTC-4, Tom Russell wrote: > >> Thanks for the tip. >> >> I did set one field to not be readable like this: >> >> Field('alternatepid', label='Alternate PID', readable=False), >> >> but it still shows on my form. >> >> Should'nt be there should it? >> >> Thanks. >> >> >> On Mon, Jun 24, 2013 at 1:57 PM, Anthony <abas...@gmail.com> wrote: >> >>> db.patient(fields=['first_**name']) >>> >>> No, the above isn't web2py syntax -- don't know where you saw that. As I >>> mentioned, to control which fields are shown, you can set the readable and >>> writable attributes of the fields (check the book), or you can list >>> individual fields instead of entire tables: >>> >>> SQLFORM.factory(db.mytable.myf**ield, db.mytable.myotherfield, db. >>> wholetable) >>> >>> Anthony >>> >>> >>> On Monday, June 24, 2013 11:49:43 AM UTC-4, Tom Russell wrote: >>> >>>> I tried doing the specific fields like: >>>> >>>> form=SQLFORM.factory(db.**patien**t(fields=['first_name'])**, >>>> db.emergencycontacts, db.dependents, formstyle = 'table3cols') >>>> >>>> but that just throws an error saying no tables selected. I guess what I >>>> am trying to do is set certain fields to be show for each table and read >>>> the book but do not see how I would set it in my code as such. All of the >>>> examples I have seen so far show only 1 table at a time. >>>> >>>> >>>> On Mon, Jun 24, 2013 at 11:29 AM, Anthony <abas...@gmail.com> wrote: >>>> >>>>> You can set the readable and writable attributes of the fields, or >>>>> .factory() can take a list of specific fields rather than entire tables. >>>>> >>>>> Anthony >>>>> >>>>> >>>>> On Monday, June 24, 2013 11:15:28 AM UTC-4, Tom Russell wrote: >>>>>> >>>>>> If I have a form factory with 3 tables, how would I define the fields >>>>>> I wanted shown for each? >>>>>> >>>>>> This is the code for my controller. I have tried to set it in several >>>>>> spots but all of them throw an error. >>>>>> >>>>>> def register_patient(): >>>>>> mark_not_empty(db.patient) >>>>>> mark_not_empty(db.**emergencycon****tacts) >>>>>> mark_not_empty(db.dependents) >>>>>> form=SQLFORM.factory(db.**patien****t, db.emergencycontacts, >>>>>> db.dependents, formstyle = 'table3cols') >>>>>> fs0=form[0][:28] # the first two name rows >>>>>> fs1=form[0][28:40] # the wine data rows (all but the last) >>>>>> fs2=form[0][40:45] # submit row (last) >>>>>> fs3=form[0][-1] # submit row (last) >>>>>> >>>>>> form.vars.medical_record_**numbe****r = 'KND' + >>>>>> str(date.today().year) + '0000' + str(random.randrange(1, 9999999+1)) >>>>>> >>>>>> form[0]=TABLE( >>>>>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="**registe**** >>>>>> r0"), >>>>>> FIELDSET(TAG.legend("Emergency Contact Info"),TABLE(fs1),_id="** >>>>>> registe****r1"), >>>>>> FIELDSET(TAG.legend("**Dependent****s"),TABLE(fs2),_id="** >>>>>> register2"****), >>>>>> TABLE(fs3)) >>>>>> if form.process().accepted: >>>>>> id = db.patient.insert(**db.**patient**** >>>>>> ._filter_fields(form.**vars)) >>>>>> form.vars.patient=id >>>>>> id = db.emergencycontacts.insert(******** >>>>>> db.emergencycontacts._filter_**f****ields(form.vars)) >>>>>> response.flash='Thanks for filling the form' >>>>>> id = db.dependents.insert(**db.**depe**** >>>>>> ndents._filter_fields(**form.**var**s)) >>>>>> form.vars.dependents=id >>>>>> # and get a list of all persons >>>>>> redirect(URL('manage_patients'******)) >>>>>> >>>>>> style = STYLE(""".not_empty {color:#d00;}""") >>>>>> >>>>>> return dict(form=DIV(style,form)) >>>>>> >>>>>> >>>>>> Thanks. >>>>>> >>>>> -- >>>>> >>>>> --- >>>>> 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+un...@**googlegroups.com. >>>>> >>>>> For more options, visit >>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out> >>>>> . >>>>> >>>>> >>>>> >>>> >>>> -- >>> >>> --- >>> 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+un...@**googlegroups.com. >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> >>> >> >> -- > > --- > 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/groups/opt_out. > > > -- --- 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/groups/opt_out.