Home
The Toolkit for Online Communities
15939 Community Members, 1 member online, 2469 visitors today
Log In Register

Forum OpenACS Q&A: Setting properties in form's elements

OpenACS Home : Forums : OpenACS Q&A : Setting properties in form's elements

Icon of Envelope Request notifications

+
Posted by Claudio Pasolini on
Hy all,
I need to set dynamically a property in a form element.

AFAIK both the 'element::create' and 'element::set_properties' API accept a key-value pair wich is perfectly suited to manage properties like foo=bar, but I can't find a way to set a single word property like 'readonly'.
Any ideas?

TIA, Claudio

+
Posted by Ernst Guenter on
Hi!

I faced the same problem. I simply supplied an empty string for value (see example). This worked fine for me.

template::element create main shortname -datatype text -widget text -html {size 70 readonly ""} -label Shortname

EG

+
Posted by Claudio Pasolini on
Thank You very much, Ernst!
+
Posted by Don Baccus on
The ad_form version:
ad_form -name main {
    {shortname:text    {label "Shortname"}
                       {html {size 70 readonly ""}}}
}
(it uses the form builder as its backend).

The biggest advantage of ad_form is that it handles all the state management (submit, request, etc) for you.