def trigger_js     
      # will find the first answer (if multiple/checkboxes) where the expression evaluates to true (downcase both to be case insensitive)
      # if no match, disabled will be true, otherwise false
      js = <<-JS
      disabled = (response.find(function(answer) {
        answer = toLowerCase(answer);
        return eval("#{escape_javascript(self.expression.downcase)}");
      }) == undefined);
      JS
      
      if toggle_id.nil?
        # toggling a whole page (link), which will affect final page validation
      else
        # toggling an element (form element)... if page is loaded/cached (if not, the server-side will take care of it on load)
        js = js + <<-JS
        if(page_handler.isPageLoaded('page_#{self.toggle_page_id}'))
        {
          $('element_#{self.toggle_id}').disabled = disabled;
        }
        JS
      end
      
      js
    end
def trigger_js     
      # will find the first answer (if multiple/checkboxes) where the expression evaluates to true (downcase both to be case insensitive)
      # if no match, disabled will be true, otherwise false
      js = <<-JS
      disabled = (response.find(function(answer) {
        answer = toLowerCase(answer);
        return eval("#{escape_javascript(self.expression.downcase)}");
      }) == undefined);
      JS
      
      if toggle_id.nil?
        # toggling a whole page (link), which will affect final page validation
      else
        # toggling an element (form element)... if page is loaded/cached (if not, the server-side will take care of it on load)
        js = js + <<-JS
        if(page_handler.isPageLoaded('page_#{self.toggle_page_id}'))
        {
          $('element_#{self.toggle_id}').disabled = disabled;
        }
        JS
      end
      
      js
    end
javascript to toggle pages/elements based on the "response"