Sha256: d596d0f9eb27a0ebcbf81d9689e0a66d56614052edd30f8cd9afc605718dabc0
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
function validate<%= model_class %>Form() { $('#form_<%= instance_name %>').validation({ required: [ {name: '<%= instance_name %>[first_name]'}, {name: '<%= instance_name %>[last_name]'}, {name: '<%= instance_name %>[designation]'}, { name : '<%= instance_name %>[email]', // email must contain an @ validate : function($el) { return $el.val().match('@') !== null; } } ], fail: function(failed) { errorText = "Please fill out all the required fields and ensure the data entered is valid."; $("#div_<%= instance_name %>_form_error").remove(); txtDiv = "<div id='div_<%= instance_name %>_form_error' class=\"alert danger\" data-alert=\"alert\" style=\"margin-bottom:5px;\">"+ errorText +"</div>" $("#div_<%= instance_name %>_details").prepend(txtDiv); }, submit: function(data) { $.ajax({ url: $("#form_<%= instance_name %> input[name=faction]").val(), type: $("#form_<%= instance_name %> input[name=fmethod]").val(), dataType: 'script', data: data }); } }); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
humdrum-rails-0.0.7 | lib/rails/generators/humdrum/resource/templates/javascripts/validations/validator.js |