aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-09-06 13:19:33 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-09-09 08:06:52 +0100
commitee026b1e36f57d67044d00d822502c576d4c150c (patch)
treeb1b0d611b4394ec9922b366ec306ed758251c268
parent15efdd9df65dff2340f364e17014e1afa1b449d6 (diff)
Tidy/remove some old validation code.
-rw-r--r--templates/web/base/report/update-form.html2
-rw-r--r--templates/web/bromley/report/display.html2
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js34
-rw-r--r--web/cobrands/sass/_base.scss9
4 files changed, 3 insertions, 44 deletions
diff --git a/templates/web/base/report/update-form.html b/templates/web/base/report/update-form.html
index 97e0df779..58cd16253 100644
--- a/templates/web/base/report/update-form.html
+++ b/templates/web/base/report/update-form.html
@@ -22,7 +22,7 @@
[% END %]
[% IF c.user_exists %]
[% INCLUDE 'report/update/form_name.html' %]
- <div class="clearfix"><input class="final-submit green-btn" type="submit" id="update_post" value="[% loc('Post') %]"></div>
+ <div class="clearfix"><input class="final-submit green-btn" type="submit" id="submit_register" value="[% loc('Post') %]"></div>
[% ELSIF oauth_need_email %]
[% INCLUDE 'report/update/form_user_loggedout_email.html' required = 1 %]
<div id="form_sign_in">
diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html
index f30824385..dc1cacf83 100644
--- a/templates/web/bromley/report/display.html
+++ b/templates/web/bromley/report/display.html
@@ -100,7 +100,7 @@
[% INCLUDE name %]
- <input class="final-submit green-btn" type="submit" id="update_post" value="[% loc('Post') %]">
+ <input class="final-submit green-btn" type="submit" id="submit_register" value="[% loc('Post') %]">
[% ELSE %]
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 2b55983bc..208ac77ac 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -217,7 +217,6 @@ $.extend(fixmystreet.set_up, {
jQuery.validator.addMethod('validCategory', function(value, element) {
return this.optional(element) || value != '-- Pick a category --'; }, translation_strings.category );
- var form_submitted = 0;
var submitted = false;
$("form.validate").each(function(){
@@ -228,21 +227,13 @@ $.extend(fixmystreet.set_up, {
onfocusout: false,
errorElement: 'div',
errorClass: 'form-error',
- // we do this to stop things jumping around on blur
- success: function (err) { if ( form_submitted ) { err.addClass('label-valid').removeClass('label-valid-hidden').html( '&nbsp;' ); } else { err.addClass('label-valid-hidden'); } },
errorPlacement: function( error, element ) {
- // Different for old/new style design
- if ($('.form-field').length) {
- element.parent('div.form-field').before( error );
- } else {
- element.before( error );
- }
+ element.before( error );
},
submitHandler: function(form) {
if (form.submit_problem) {
$('input[type=submit]', form).prop("disabled", true);
}
-
form.submit();
},
// make sure we can see the error message when we focus on invalid elements
@@ -257,8 +248,6 @@ $.extend(fixmystreet.set_up, {
});
});
- $('input[type=submit]').click( function(e) { form_submitted = 1; } );
-
/* set correct required status depending on what we submit
* NB: need to add things to form_category as the JS updating
* of this we do after a map click removes them */
@@ -281,21 +270,6 @@ $.extend(fixmystreet.set_up, {
$('#form_fms_extra_title').addClass('required');
} );
- $('#problem_submit > input[type="submit"]').click( function(e) {
- $('#form_category').addClass('required validCategory').removeClass('valid');
- $('#form_name').addClass('required');
- if ( $('#mapForm').length ) {
- $('#form_name').addClass('validName');
- }
- $('#form_first_name').addClass('required');
- $('#form_last_name').addClass('required');
- $('#form_fms_extra_title').addClass('required');
- } );
-
- $('#update_post').click( function(e) {
- $('#form_name').addClass('required').removeClass('valid');
- } );
-
$('#facebook_sign_in, #twitter_sign_in').click(function(e){
$('#form_email').removeClass();
$('#form_rznvy').removeClass();
@@ -415,12 +389,6 @@ $.extend(fixmystreet.set_up, {
});
},
- add_validation: function() {
- // Map form doesn't work in some browsers with HTML5 validation and hidden form, so
- // we disable validation by default, and add it in the JS case.
- $('#mapForm').removeAttr('novalidate');
- },
-
contribute_as: function() {
$('.content').on('change', '.js-contribute-as', function(){
var opt = this.options[this.selectedIndex],
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index 576538daa..d1fdec343 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -458,15 +458,6 @@ ul.error {
@include border-radius(0.25em);
}
-// don't display valid error boxes as now the page jump
-// won't be until the user submits, which is fine
-div.label-valid,
-p.label-valid {
- display:none !important;
- visibility: hidden;
-}
-
-
/*** LAYOUT ***/