Yes I just tried it and that works fine. That works as expected. Thanks for
the help. Exactly what I was looking for to begin with.


On Tue, Jun 25, 2013 at 1:23 AM, Anthony <abasta...@gmail.com> wrote:

> Did you try this method (setting these before creating the form):
>
> db.mytable.myfield.default = some_value
> db.mytable.myfield.writable = False
>
> Anthony
>
> On Tuesday, June 25, 2013 1:02:40 AM UTC-4, Tom Russell wrote:
>
>> Yes I understand that. What would be the best way to handle this?
>> Seemingly, the couple of items suggested did not work for me so I am not
>> sure where that leaves me.
>>
>>
>> On Tue, Jun 25, 2013 at 12:35 AM, Anthony <abas...@gmail.com> wrote:
>>
>>> Yes that works, though it's not as secure because someone can still
>>> submit a value for that field if they are determined, so you might want to
>>> check for that variable on the server and delete it if submitted.
>>>
>>> Anthony
>>>
>>>
>>> On Tuesday, June 25, 2013 12:15:04 AM UTC-4, Tom Russell wrote:
>>>
>>>> I ended up doing this in the controller which works for what I need:
>>>>
>>>> form.element('#no_table_**medica**l_record_number')['_**readonly']**
>>>> =True
>>>>
>>>>
>>>> On Tue, Jun 25, 2013 at 12:03 AM, Anthony <abas...@gmail.com> wrote:
>>>>
>>>>> 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_**numbe****r = '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 <abas...@gmail.com> 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 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/**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.


Reply via email to