Hi,
I have a new ad_form question. I love ad_form, but it doesn't do
as I want. 😊
The following bombs, so how can I dynamically choose the type of
widget, as in this example, or the datatype, etc?
The documentation for ad_form says this, which I don't understand
very well:
In order to make it possible to use ad_form to build common
form snippets within procs, code blocks are executed at the
current template parse level. This is necessary if validate and
similar blocks are to have access to the form's contents but may
cause surprises for the unwary. So be wary.
On the other hand when subst is called, for instance when setting
values in the form, the caller's level is used. Why do this? A
proc building a common form snippet may need to build a list of
valid select elements or similarly compute values that need to be
set in the form, and these should be computed locally.
if $some_condition_p {
set widget text
} else {
set widget inform
}
ad_form -form {
test_id:key
{test:text($widget) {label "Test"}
{value {This is a test}}}
}
....
Does anyone know ad_form well yet, except Don?
Thanks,