I'm not sure that method will work for readonly fields, so you may have to 
use the method I showed (i.e., set the default value for the field before 
creating the form).

Anthony

On Monday, June 24, 2013 11:23:01 PM UTC-4, Tom Russell wrote:
>
> Yes I tried that:
>
> Field('medical_record_number',  label='MRN', writable=False, 
> readable=True, requires=IS_NOT_EMPTY()),
>
> Still just shows none for the field on the form.
>
> In my controller this is what I am doing:
>
> form.vars.medical_record_number = 'KND' + str(date.today().year) + '0000' 
> + str(random.randrange(1, 9999999+1))
>
> If I set both to True then it shows the value no problem.
>
> Thanks,
>
> Tom
>
>
> On Mon, Jun 24, 2013 at 11:17 PM, Anthony <[email protected] <javascript:>
> > wrote:
>
>> db.mytable.myfield.default = some_value
>> db.mytable.myfield.writable = False
>>
>> Leave readable at True in order to show the value but not allow it to be 
>> edited.
>>
>> Anthony
>>
>>
>> On Monday, June 24, 2013 11:00:59 PM UTC-4, Tom Russell wrote:
>>>
>>> I have a form and I load a pre existing value that I generate internally 
>>> before I call the form. What I want to see on the form is the value shown 
>>> up but just as plain text so the user cannot modify it. If I do 
>>> readable-False then it just shows None for the value rather than the value. 
>>>
>>> How would I make that happen on the form then?
>>>
>>> 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 [email protected] <javascript:>.
>> 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to