Changeset - d28ffd68ca45
[Not reviewed]
0 2 0
Brett Smith (brett) - 4 years ago 2016-12-02 17:35:19
brett@sfconservancy.org
supporter: HTML5 improvements to form.

* Use "number" type for a better prompt.
* Use new standard "min" attribute for richer validation.
2 files changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/js/supporter-page.js
Show inline comments
...
 
@@ -117,7 +117,7 @@ $(document).ready(function() {
 
        noCommaValue = value.replace(/,/g, "");
 
        var re = /^((\d{1,3}(,?\d{3})*?(\.\d{0,2})?)|\d+(\.\d{0,2})?)$/;
 
        var isValid = ( re.test(value) &&
 
                        parseInt(noCommaValue) >= parseInt(input.attr("minimum")));
 
                        parseInt(noCommaValue) >= parseInt(input.attr("min")));
 
        if (isValid)  {
 
           input.removeClass("invalid").addClass("valid");
 
           errorElement.removeClass("form-error-show").addClass("form-error");
www/conservancy/static/supporter/2016-supporter-appeal.html
Show inline comments
...
 
@@ -69,7 +69,7 @@
 
            <input type="hidden" name="item_name" value="Conservancy Supporter, Annual" />
 
            <input id="no_shipping" type="hidden" name="no_shipping" value="0" />
 
  <label for="amount"><strong>Amount:</strong> $</label>
 
  <input id="amount" type="text" name="amount" size="7" minimum="120" value="120" />
 
  <input id="amount" type="number" name="amount" size="7" min="120" value="120" />
 
  <span id="error" class="form-error-show">$120 is a minimum for Conservancy
 
  Supporters.  <a href="/donate">Donate smaller amounts here</a>.</span><br/>
 

	
...
 
@@ -138,7 +138,7 @@
 
            <input type="hidden" name="srt" value="0" />
 
            <input type="hidden" name="item_name" value="Conservancy Supporter, Monthly" />
 
  <label for="amount"><strong>Monthly Amount:</strong> $</label>
 
  <input id="amount" type="text" name="a3" size="5" minimum="10" value="10" />
 
  <input id="amount" type="number" name="a3" size="5" min="10" value="10" />
 
  <span id="error" class="form-error-show">$10/month is a minimum for Conservancy
 
  Supporters.  <a href="/donate">Donate smaller amounts here</a>.</span><br/>
 
                      <label for="wantGift"><strong>Do you want to receive a t-shirt? </strong></label>
...
 
@@ -197,7 +197,7 @@
 
            <input type="hidden" name="item_name" value="Conservancy Supporter, Annual Renewal" />
 
            <input id="no_shipping" type="hidden" name="no_shipping" value="0" />
 
  <label for="amount"><strong>Amount:</strong> $</label>
 
  <input id="amount" type="text" name="amount" size="7" minimum="120" value="120" />
 
  <input id="amount" type="number" name="amount" size="7" min="120" value="120" />
 
  <span id="error" class="form-error-show">$120 is a minimum for Conservancy
 
  Supporters.  <a href="/donate">Donate smaller amounts here</a>.</span><br/>
 

	
0 comments (0 inline, 0 general)