opt-in form adder... i am having trouble getting the code to work using phplist. The form will either not work at all or it will redirect to the default phplist page if i change the form "action" field. Here is the code im using:
<!--start code
<script language="Javascript" type="text/javascript">
function checkform() {
for (i=0;i<fieldstocheck.length;i++) {
if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].type") == "checkbox") {
if (document.subscribeform.elements[fieldstocheck[i]].checked) {
} else {
alert("Please enter your "+fieldnames[i]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
else {
if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
alert("Please enter your "+fieldnames[i]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
}
for (i=0;i<groupstocheck.length;i++) {
if (!checkGroup(groupstocheck[i],groupnames[i])) {
return false;
}
}
return true;
}
var fieldstocheck = new Array();
var fieldnames = new Array();
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
var groupstocheck = new Array();
var groupnames = new Array();
function addGroupToCheck(value,name) {
groupstocheck[groupstocheck.length] = value;
groupnames[groupnames.length] = name;
}
function compareEmail()
{
return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
}
function checkGroup(name,value) {
option = -1;
for (i=0;i<document.subscribeform.elements[name].length;i++) {
if (document.subscribeform.elements[name][i].checked) {
option = i;
}
}
if (option == -1) {
alert ("Please enter your "+value);
return false;
}
return true;
}
</script>
<form method="post" action="http://www.jemkarsales.com/phplist/?p..." name="subscribeform" style type="text/css" target="windowName" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');">
<table border=0>
<tr><td><div class="required">Email</div></td>
<td class="attributeinput"><input type=text name=email value="" size="40">
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email");</script></td></tr><input type=hidden name="htmlemail" value="1">
<tr><td><div class="required">Name</div></td><td class="attributeinput">
<input type=text name="attribute4" class="attributeinput" size="40" value=""><script language="Javascript" type="text/javascript">addFieldToCheck("attribute4","Name");</script></td></tr>
</table>
<input type="hidden" name="subscribe" value="yes">
<input type="hidden" name="list[3]" value="signup">
<input type="hidden" name="listname[3]" value="JEMKARsales.com Newsletter"/><div style="display:none">
<input type="text" name="VerificationCodeX" value="" size="20"></div><p>
<input type=submit name="subscribe" value="Subscribe to the Selected Newsletters" onClick="return checkform();"></p>
</form>
end code-->
-
EMPLOYEE
1I extracted the html form code from the code you sent , below is the code
<!--
<form method="post" action="http://www.jemkarsales.com/phplist/?p..." name="subscribeform" style type="text/css" target="windowName" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');">
<table border=0>
<tr><td><div class="required">Email</div></td>
<td class="attributeinput"><input type=text name=email value="" size="40">
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email");</script></td></tr><input type=hidden name="htmlemail" value="1">
<tr><td><div class="required">Name</div></td><td class="attributeinput">
<input type=text name="attribute4" class="attributeinput" size="40" value=""><script language="Javascript" type="text/javascript">addFieldToCheck("attribute4","Name");</script></td></tr>
</table>
<input type="hidden" name="subscribe" value="yes">
<input type="hidden" name="list[3]" value="signup">
<input type="hidden" name="listname[3]" value="JEMKARsales.com Newsletter"/><div style="display:none">
<input type="text" name="VerificationCodeX" value="" size="20"></div><p>
<input type=submit name="subscribe" value="Subscribe to the Selected Newsletters" onClick="return checkform();"></p>
</form>
-->
So after you detect the form select "attribute4" as the name field and email for the email field.
Then it will work fine -
-
Thank you...that code seems to work fine with the exception of not opening in a new window. I can deal with that if i have to.
Thanks again -
Loading Profile...



Twitter,
Facebook, or email.

