Hey all.
I’ve blinded myself for today perfecting my forms for a site. The following script works fine but I’d like to know if there are any redundancies. The variables are defined and used often elsewhere.
I’m just calculated out so … hoping for some streamlining advice.
[CODE]var posting = ‘false’;
var input;
var estatus;
var iframe = ‘false’;
var process;
var valid;
var sent;
function RunForm(action) {
if (action == ‘post’) {
if (posting != ‘true’) {
if (/^([_a-z0-9-]+)(.[_a-z0-9-]+)*@([a-z0-9-]+)(.[a-z0-9-]+)*(.[a-z]{2,4})$/.test(input.value)) {
setTimeout(“posting = ‘true’;”, 0);
estatus.style.display = ‘block’;
setTimeout(“content.focus();”, 0);
if (iframe != ‘true’) {process.innerHTML = ‘<iframe name=”process” frameborder=”0″ scrolling=”no”></iframe>’; iframe = ‘true’;}
return true;
} else {
valid = ‘false’;
alert(‘Please enter a valid email address.’);
input.focus();
input.value = ”;
valid = ‘true’;
return false;
}
}
else return false;
} else {
input.value = ‘Confirmation Email Sent’;
sent = ‘true’;
estatus.style.display = ”;
posting = ‘false’;
}
}