added status messages to the email submission form

pull/4/head
joates 10 years ago
parent b2696fe0eb
commit f620653e86

@ -12,6 +12,8 @@
margin-left: -5px;
}
.input{width: 100%;}
#status-msg.info{color: black}
#status-msg.error{color: red}
/*mq madness*/
.maxW, .dskW,.tblW{display:none;}
@ -28,4 +30,4 @@
@media (max-width: 979px) {
.tblW{display:block;}
}
@media (min-width: 980px) {}
@media (min-width: 980px) {}

@ -34,6 +34,7 @@
<input type="checkbox" name="paris"> Paris Nov.2014?
</label>
<button type="submit" class="btn">Send</button>
<div id="status-msg">&nbsp;</div>
</fieldset>
</form>
</div>

@ -6,6 +6,7 @@ process.nextTick(function() {
var form = document.getElementById('signup-form')
, input_email = ''
, status_msg = document.getElementById('status-msg')
for (var n = 0, l = form.childNodes[1].childNodes.length; n < l; n++) {
var el = form.childNodes[1].childNodes[n]
@ -20,11 +21,16 @@ process.nextTick(function() {
if (input_email && input_email.value) {
var is_valid = check_email(input_email.value)
if (is_valid) {
alert('got it, thanks '+ input_email.value)
form.submit()
status_msg.className = 'info'
status_msg.innerHTML = "Got it, thanks"
setTimeout(function() { form.submit() }, 600)
} else {
input_email.value = ''
alert("that doesn't look like an email address,\nplease try again...")
e.preventDefault()
status_msg.className = 'error'
status_msg.innerHTML = "that doesn't look like an email address,"
+ "<br />please try again..."
setTimeout(function() { status_msg.innerHTML = '&nbsp;' }, 2000)
}
}
}

Loading…
Cancel
Save