supporter: HTML5 improvements to form.
* Use "number" type for a better prompt. * Use new standard "min" attribute for richer validation.
This commit is contained in:
parent
4afce1eadc
commit
d28ffd68ca
2 changed files with 4 additions and 4 deletions
|
@ -117,7 +117,7 @@ $(document).ready(function() {
|
||||||
noCommaValue = value.replace(/,/g, "");
|
noCommaValue = value.replace(/,/g, "");
|
||||||
var re = /^((\d{1,3}(,?\d{3})*?(\.\d{0,2})?)|\d+(\.\d{0,2})?)$/;
|
var re = /^((\d{1,3}(,?\d{3})*?(\.\d{0,2})?)|\d+(\.\d{0,2})?)$/;
|
||||||
var isValid = ( re.test(value) &&
|
var isValid = ( re.test(value) &&
|
||||||
parseInt(noCommaValue) >= parseInt(input.attr("minimum")));
|
parseInt(noCommaValue) >= parseInt(input.attr("min")));
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
input.removeClass("invalid").addClass("valid");
|
input.removeClass("invalid").addClass("valid");
|
||||||
errorElement.removeClass("form-error-show").addClass("form-error");
|
errorElement.removeClass("form-error-show").addClass("form-error");
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
<input type="hidden" name="item_name" value="Conservancy Supporter, Annual" />
|
<input type="hidden" name="item_name" value="Conservancy Supporter, Annual" />
|
||||||
<input id="no_shipping" type="hidden" name="no_shipping" value="0" />
|
<input id="no_shipping" type="hidden" name="no_shipping" value="0" />
|
||||||
<label for="amount"><strong>Amount:</strong> $</label>
|
<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
|
<span id="error" class="form-error-show">$120 is a minimum for Conservancy
|
||||||
Supporters. <a href="/donate">Donate smaller amounts here</a>.</span><br/>
|
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="srt" value="0" />
|
||||||
<input type="hidden" name="item_name" value="Conservancy Supporter, Monthly" />
|
<input type="hidden" name="item_name" value="Conservancy Supporter, Monthly" />
|
||||||
<label for="amount"><strong>Monthly Amount:</strong> $</label>
|
<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
|
<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/>
|
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>
|
<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 type="hidden" name="item_name" value="Conservancy Supporter, Annual Renewal" />
|
||||||
<input id="no_shipping" type="hidden" name="no_shipping" value="0" />
|
<input id="no_shipping" type="hidden" name="no_shipping" value="0" />
|
||||||
<label for="amount"><strong>Amount:</strong> $</label>
|
<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
|
<span id="error" class="form-error-show">$120 is a minimum for Conservancy
|
||||||
Supporters. <a href="/donate">Donate smaller amounts here</a>.</span><br/>
|
Supporters. <a href="/donate">Donate smaller amounts here</a>.</span><br/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue