anchor.diff:          };
   
           $scope.canForecast = function() {
  -            return $scope.metricToForecast !== null && $scope.forecastingTemplate !== null;
  +            return $scope.metricToForecast !== null && $scope.forecastingTemplate !== null
  +                && $scope.form.$valid
  +                && ($scope.forecastingOptions.season * 2) < $scope.forecastingOptions.trainingStart;
           };
   
           $scope.forecast = function() {
  
positive.code:   <jsp:param name="script" value='<script type="text/javascript" src="js/underscore-min.js"></script>' />
  </jsp:include>
  
  <div ng-app="forecast" ng-controller="forecastCtrl">
  
  <div class="row-fluid">
      <div class="col-md-12">
        <div class="panel panel-default">
        <div class="panel-heading text-center">
          <h3 class="panel-title">Forecasting <%= request.getParameter("report") %> on <%= request.getParameter("resourceId") %> </h3>
        </div> <!-- panel-heading -->
        <div class="panel-body">
  		<div class="row-fluid">
  			<div class="col-md-7">
  		        <div data-graph-report="<%= request.getParameter("report") %>" data-graph-resource="<%= request.getParameter("resourceId") %>"></div>
  		    </div>
  		    <div class="col-md-4" ng-hide="series.length < 1">
  		        <form class="form-horizontal">
  		            <div class="form-group">
  		                <div class="col-sm-12">
  		                    <label for="select-metric">Select the metric to forecast:</label>
  
negative.code:     </div> <!-- col-md-12 -->
  </div> <!-- row -->
  
  
  <script>
      function getBaseHref() {
          return "<%= baseHref %>";
      }
  
      var app = angular.module("forecast", []);
  
      var INTEGER_REGEXP = /^\-?\d+$/;
      app.directive('integer', function() {
        return {
          require: 'ngModel',
          link: function(scope, elm, attrs, ctrl) {
            ctrl.$validators.integer = function(modelValue, viewValue) {
              if (ctrl.$isEmpty(modelValue)) {
                // consider empty models to be valid
                return true;
              }
  
              if (INTEGER_REGEXP.test(viewValue)) {
                // it is valid
                return true;
              }
  
              // it is invalid
              return false;
            };
          }
        };
      });
  
      app.directive('greaterThanZero', function() {
          return {
            require: 'ngModel',
            link: function(scope, elm, attrs, ctrl) {
              ctrl.$validators.integer = function(modelValue, viewValue) {
                if (ctrl.$isEmpty(modelValue)) {
                  return false;
                }
                return viewValue > 0;
              };
            }
          };
        });
  
      app.controller("forecastCtrl", function($scope) {
          // Use the first div we find with the data-graph-report attribute
          $scope.graphElement = $("div[data-graph-report]").first();
  