I'm editing Dotmailer's signup form code as some of my users won't have email addresses. I want to set the form so that if the user does not enter a value for their email address, for it to default to say test@test.com
The field must be filled for it to successfully upload for the Dotmailer DB so I can't just remove it as a required field.
Below is the script at the start of the form which seems to be causing the issues (from my limited knowledge)
<script language="javascript">// <![CDATA[
function validate_signup(frm) {
var emailAddress = frm.Email.value;
var errorString = '';
if (emailAddress == '' || emailAddress.indexOf('@') == -1) {
errorString = 'Please enter your email address';
}
var isError = false;
if (errorString.length > 0)
isError = true;
if (isError)
alert(errorString);
return !isError;
}
// ]]></script>
Ty in advance for any assistance you can provide.
You just need to change
if (emailAddress == '' || emailAddress.indexOf('@') == -1) { errorString = 'Please enter your email address'; }
to
if (emailAddress == '' || emailAddress.indexOf('@') == -1) { var input = document.getElementById('#myInput'); input.value = "test@test.com";
}
where #myInput is the id of the email field.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.