Commit 78b2a14093df61a3cdece5ad91ef968b8b9911ce
Committed by
Diego Camarinha
1 parent
8a277162
Exists in
master
and in
29 other branches
[Mezuro] Implemented validation for code configuration.
Showing
2 changed files
with
8 additions
and
3 deletions
Show diff stats
plugins/mezuro/public/javascripts/validations.js
1 | function validate_metric_configuration(){ | 1 | function validate_metric_configuration(){ |
2 | - alert("Pizza"); | ||
3 | -} | ||
4 | \ No newline at end of file | 2 | \ No newline at end of file |
3 | + var x=document.forms["configuration_form"]["metric_configuration[code]"].value; | ||
4 | + if (x==null || x=="") | ||
5 | + { | ||
6 | + alert("Code must be filled out"); | ||
7 | + return false; | ||
8 | + } | ||
9 | +} |
plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | 3 | ||
4 | <h2><%= @configuration_name %> Configuration</h2> | 4 | <h2><%= @configuration_name %> Configuration</h2> |
5 | 5 | ||
6 | -<% form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get, :html => { :onSubmit => 'validate_metric_configuration()'} do |f| %> | 6 | +<% form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get, :html => { :name => "configuration_form", :onSubmit => 'return validate_metric_configuration()'} do |f| %> |
7 | <%= hidden_field_tag :configuration_name, @configuration_name %> | 7 | <%= hidden_field_tag :configuration_name, @configuration_name %> |
8 | <%= hidden_field_tag :scope, @metric.scope %> | 8 | <%= hidden_field_tag :scope, @metric.scope %> |
9 | 9 |