Changeset - 8c3ecd347abd
[Not reviewed]
0 3 0
Bradley Kuhn (bkuhn) - 7 years ago 2014-12-04 01:42:33
bkuhn@ebb.org
Return amount to id; add id for error span.

I actually think I want amount to be id rather than a class, now that I
figured out the proper selector to find them all.

Also, the $("span", input.parent()) was buggy if there were any other
span's other than error-related ones in the supporter-form-inputs div.

Finally, ditch that <small> stuff and simply place a font-size reduction
into the CSS for the form-error-show.
3 files changed with 10 insertions and 9 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/forms.css
Show inline comments
...
 
@@ -25,6 +25,7 @@
 
.form-error-show {
 
    color: red;
 
    margin-left: 10px;
 
    font-size: 75%;
 
}
 

	
 
input.invalid, textarea.invalid {
www/conservancy/static/supporter-page.js
Show inline comments
...
 
@@ -44,11 +44,11 @@ $(document).ready(function() {
 
            $("#no_shipping").val("0");
 
        }
 
    });
 
    $('.amount').addClass("valid");
 
    $('.amount').on('input', function() {
 
    $('*#amount').addClass("valid");
 
    $('*#amount').on('input', function() {
 
        var input=$(this);
 
        var value = input.val();
 
        var errorElement=$("span", input.parent());
 
        var errorElement=$("span#error", input.parent());
 
        var noCommaValue = value;
 
        noCommaValue = value.replace(/,/g, "");
 
        var re = /^((\d{1,3}(,?\d{3})*?(\.\d{0,2})?)|\d+(\.\d{0,2})?)$/;
www/conservancy/static/supporter/index.html
Show inline comments
...
 
@@ -141,9 +141,9 @@ internal policies</a> are published and available for scrutiny.</p>
 
            <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 class="amount" type="text" name="amount" size="7" minimum="120" value="120" />
 
  <span class="form-error"><small>$120 is a minimum for Conservancy
 
  Supporters.  <a href="/donate">Donate smaller amounts here</a>.</small></span><br/>
 
  <input id="amount" type="text" name="amount" size="7" minimum="120" value="120" />
 
  <span id="error" class="form-error">$120 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>
 
                      <input type="hidden" name="on1" value="wantGift" />
...
 
@@ -208,9 +208,9 @@ internal policies</a> are published and available for scrutiny.</p>
 
            <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 class="amount" type="text" name="a3" size="5" minimum="10" value="10" />
 
  <span class="form-error"><small>$10/month is a minimum for Conservancy
 
  Supporters.  <a href="/donate">Donate smaller amounts here</a>.</small></span><br/>
 
  <input id="amount" type="text" name="a3" size="5" minimum="10" value="10" />
 
  <span id="error" class="form-error">$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>
 
                      <input type="hidden" name="on1" value="wantGift" />
 
                      <input type="radio" name="os1" value="Yes" />Yes
0 comments (0 inline, 0 general)