Larger error message when submitting bad amount.
This addition to the Javascript and text ensures a clear message to the user of a Javascript-enabled browser that there is an issue with the amount. Also, it prevents submission of the form until the amount is correct. A user with Javascript disabled can circumvent these validation steps; however, the worst-case scenario is that they make a donation for less than $120 that is categorized in Conservancy's internal system as a Supporter donation, and we'll be adding internal checks to find that.
This commit is contained in:
		
							parent
							
								
									b2c18cc59e
								
							
						
					
					
						commit
						090fb9f268
					
				
					 2 changed files with 12 additions and 0 deletions
				
			
		|  | @ -43,12 +43,23 @@ $(document).ready(function() { | |||
|         if (isValid)  { | ||||
|            input.removeClass("invalid").addClass("valid"); | ||||
|            errorElement.removeClass("form-error-show").addClass("form-error"); | ||||
|            $("#form-correction-needed").removeClass("form-error-show").addClass("form-error"); | ||||
|         } | ||||
|         else { | ||||
|             input.removeClass("valid").addClass("invalid"); | ||||
|             errorElement.removeClass("form-error").addClass("form-error-show"); | ||||
|         } | ||||
|     }); | ||||
|     $("#supporter-form-submit").click(function(event){ | ||||
| 	var valid = $('#amount').hasClass("valid"); | ||||
|         if (! valid) { | ||||
|             $("#form-correction-needed").removeClass("form-error").addClass("form-error-show") | ||||
|                                         .css("font-weight", "bold").css("font-size", "150%"); | ||||
| 	    event.preventDefault(); | ||||
|         } else { | ||||
|             $("#form-correction-needed").removeClass("form-error-show").addClass("form-error"); | ||||
|         } | ||||
|     }); | ||||
|     /* Handle toggling of annual/monthly form selections */ | ||||
|     $('.supporter-type-selection#monthly').hide(); | ||||
|     $('#annualSelector').css("font-weight", "bold").css("font-size", "127%"); | ||||
|  |  | |||
|  | @ -234,6 +234,7 @@ internal policies</a> are published and available for scrutiny.</p> | |||
|                       options to the right first.</small> | ||||
|                       </div> | ||||
| </form> | ||||
| <span id="form-correction-needed" class="form-error">Please ensure all form data above is correct.</span> | ||||
| </div> | ||||
| </div> | ||||
| {% endblock %} | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn