Is it possible to integrate a Phplist subscribe page into a Joomla page using a Chrono Form?
I've got the form showing in my Joomla site, but the information is not posting to Phplist on submittal. Here's the custom subscribe page form code:
I've included the top portion of the Javascript in the Form Javascript box without the opening and closing script tags. The rest of the code is in the Form HTML box. I assume its not working because there's still Javascript wrapped into the form and a problem with my PHP code.
Post edited by: jessekanclerz, at: 2008/01/02 00:58<br><br>Post edited by: jessekanclerz, at: 2008/01/02 00:59
I've got the form showing in my Joomla site, but the information is not posting to Phplist on submittal. Here's the custom subscribe page form 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;
}
}
if(! compareEmail())
{
alert("Email Addresses you entered do not match"«»);
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.jessekanclerz.com/lists/?p=subscribe" name="subscribeform"><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>
<tr><td><div class="required">Confirm your email address</div></td>
<td class="attributeinput"><input type=text name=emailconfirm value="" size="40">
<script language="Javascript" type="text/javascript">addFieldToCheck("emailconfirm",""«»);</script></td></tr><input type=hidden name="htmlemail" value="1">
<tr><td><div class="required">Last Name</div></td><td class="attributeinput">
<input type=text name="attribute2" class="attributeinput" size="40" value=""><script language="Javascript" type="text/javascript">addFieldToCheck("attribute2","Last Name"«»);</script></td></tr>
<tr><td><div class="required">First Name</div></td><td class="attributeinput">
<input type=text name="attribute1" class="attributeinput" size="40" value=""><script language="Javascript" type="text/javascript">addFieldToCheck("attribute1","First Name"«»);</script></td></tr>
</table><input type="hidden" name="list[2]" value="signup"><input type="hidden" name="listname[2]" value="Job Prospects"/><div style="display:none"><input type="text" name="VerificationCodeX" value="" size="20"></div><p><input type=submit name="subscribe" value="Subscribe to Marketing & Business Insights" onClick="return checkform();"></p>
</form><br/><br/>
<p><a href="http://www.jessekanclerz.com/lists/?p=unsubscribe&id=1">Unsubscribe</a></p>
I've included the top portion of the Javascript in the Form Javascript box without the opening and closing script tags. The rest of the code is in the Form HTML box. I assume its not working because there's still Javascript wrapped into the form and a problem with my PHP code.
Post edited by: jessekanclerz, at: 2008/01/02 00:58<br><br>Post edited by: jessekanclerz, at: 2008/01/02 00:59
Hi jessekanclerz,
A couple of things will need to be fixed here.
First off ChronoForms changes the form name to 'ChronoContact_form_name' (where 'form_name' is the name you give the form in the Chrono Forms General Tab. Your Javascript will need to link to this. The easiest way is though a new variable var form = document.ChronoContact_form_name (or document.ChronoContact_subscribeform). You cna then find and replace the old document.formname references with 'form'.
Second, your form will need to go into the HTML code box *without* the <form> tags as ChronoForms adds these.
Last, to get the form to return to PHPList you'll need to put the Action URL 'http:/www.jessekanclerz.com/lists/?p=subscribe' in the Forms Manager | Form URLs | Submit URL box. (But best to make sure the firm is working OK first as you lose some access to the debug code with a Redirect.
Bob
PS Your JavaScript validation can all be done with the ChronoForms validation if you like - except for comparing the two email fields.
A couple of things will need to be fixed here.
First off ChronoForms changes the form name to 'ChronoContact_form_name' (where 'form_name' is the name you give the form in the Chrono Forms General Tab. Your Javascript will need to link to this. The easiest way is though a new variable var form = document.ChronoContact_form_name (or document.ChronoContact_subscribeform). You cna then find and replace the old document.formname references with 'form'.
Second, your form will need to go into the HTML code box *without* the <form> tags as ChronoForms adds these.
Last, to get the form to return to PHPList you'll need to put the Action URL 'http:/www.jessekanclerz.com/lists/?p=subscribe' in the Forms Manager | Form URLs | Submit URL box. (But best to make sure the firm is working OK first as you lose some access to the debug code with a Redirect.
Bob
PS Your JavaScript validation can all be done with the ChronoForms validation if you like - except for comparing the two email fields.
Hi Bob,
I appreciate your help. After some fiddling I managed to get this working and the fields to post to Phplist.
Followed your advice for the Javascript. The new variable var form = document.ChronoContact_Phplist. Phplist being what I named this form in Chrono.
For the HTML I included:
For the return to Phplist I put '/lists/?p=subscribe' in the Form URL's | Submit URL box. If you put in the full URL as suggested a 404 error comes up.
I've got to tidy the form up a bit, but I'm definitely stoked now that its working. Currently a bunch of Phplisters are using wrappers :woohoo: to integrate the subscribe form into their Joomla sites. Over the weekend I'll make a post about this solution on the Phplist forum, I expect there to be alot of happy people over there.
Thanks,
Jesse
I appreciate your help. After some fiddling I managed to get this working and the fields to post to Phplist.
Followed your advice for the Javascript. The new variable var form = document.ChronoContact_Phplist. Phplist being what I named this form in Chrono.
For the HTML I included:
<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>
<tr><td><div class="required">Confirm your email address</div></td>
<td class="attributeinput"><input type=text name=emailconfirm value="" size="40">
<script language="Javascript" type="text/javascript">addFieldToCheck("emailconfirm",""«»);</script></td></tr><input type=hidden name="htmlemail" value="1">
<tr><td><div class="required">Last Name</div></td><td class="attributeinput">
<input type=text name="attribute2" class="attributeinput" size="40" value=""><script language="Javascript" type="text/javascript">addFieldToCheck("attribute2","Last Name"«»);</script></td></tr>
<tr><td><div class="required">First Name</div></td><td class="attributeinput">
<input type=text name="attribute1" class="attributeinput" size="40" value=""><script language="Javascript" type="text/javascript">addFieldToCheck("attribute1","First Name"«»);</script></td></tr>
</table><input type="hidden" name="list[2]" value="signup"><input type="hidden" name="listname[2]" value="Job Prospects"/><div style="display:none"><input type="text" name="VerificationCodeX" value="" size="20"></div><p><input type=submit name="subscribe" value="Subscribe to Marketing & Business Insights" onClick="return checkform();"></p>
<br/><br/>
<p><a href="http://www.jessekanclerz.com/lists/?p=unsubscribe&id=1">Unsubscribe</a></p>
For the return to Phplist I put '/lists/?p=subscribe' in the Form URL's | Submit URL box. If you put in the full URL as suggested a 404 error comes up.
I've got to tidy the form up a bit, but I'm definitely stoked now that its working. Currently a bunch of Phplisters are using wrappers :woohoo: to integrate the subscribe form into their Joomla sites. Over the weekend I'll make a post about this solution on the Phplist forum, I expect there to be alot of happy people over there.
Thanks,
Jesse
Hi Jesse,
Great to here that it's working for you, well done.
Looking back at your first post the redirect url had a typo which I carefully preserved. should be 'http://www.jessekanclerz.com/lists/?p=subscribe' with http:// The short form should work fine but it's generally safer practice to include the full version.
Bob
Great to here that it's working for you, well done.
Looking back at your first post the redirect url had a typo which I carefully preserved. should be 'http://www.jessekanclerz.com/lists/?p=subscribe' with http:// The short form should work fine but it's generally safer practice to include the full version.
Bob
This topic is locked and no more replies can be posted.
