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

Collapse
Posted by kousalya S on
Thanks Brian,

I made the changes as per your instructions but couldnot see any change. I installed ajax helper as well.

Javascript doesnot seem to work in the mentioned tcl and adp files.

somewhere I have gone wrong.

Below are my files,

new.adp:
<master>
@type_js;noquote@
<formtemplate id="@form_id@"></formtemplate>

new.tcl:

set type_options [list {type1 1} {type2 2} {type3 3}]
set html_list [list onClick type_func() ]
set container_name "field2"
set after_html "<div id=\"$container_name\" ></div>"

set form_id "showhide"
ad_form \
    -name $form_id  \
    -form {

        {type:text(select)
            {label "Type"}
            {options $type_options}
            {html $html_list}
            {after_html $after_html}
        }


    }

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

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

created new2.tcl file its not being called on request.

correct me

Collapse
Posted by Brian Fenton on
Ah sorry kousalya, I forgot that my master includes the call to the Javascript. So change brian.adp to this:

<script type="text/javascript" src="/resources/ajaxhelper/prototype/prototype.js"></script>
@field1_js;noquote@

<formtemplate id="@form_id@" ></formtemplate>