Forum OpenACS Development: Re: Show/hide fields based on the different inputs

Collapse
Posted by Brian Fenton on
brian.tcl looks like this:

set field1_options [list {Two 2} {Three 3} {Four 4}]
set html_list [list onClick field1_func() ]
set container_name "other_fields"
set after_html "<div id=\"$container_name\" ></div>"

set form_id "myForm"
ad_form \
    -name $form_id  \
    -form {
        {field1:text(select)
            {label "Field1"}
            {options $field1_options}
            {html $html_list}
            {after_html $after_html}
        }
    }

set ajax_js [ah::ajaxupdate \
                -container "$container_name" \
                -url "brian2" \
                -pars "'field1='+\$F('field1')"]

set field1_js "<script language=\"javascript\"> field1_func = function() { $ajax_js } </script>"