[how to] put a subscribe form on one of my website pages

Solutions for other phpList version 2 users
Forum rules
Please do not ask questions here, this is for Solutions you have discovered or come across.

Re: [how to] put a subscribe form on one of my website pages

Postby damiantaylor » 2:14pm, Sun 22 Sep, 2013

I've been through all 16 pages in this thread but still can't get this to work!

I have a form at the foot of my webpage here http://www.snowrepublic.co.uk
If I enter an email address and hit the subscribe button, I just get redirected to the default signup page with all fields blank.

What am I doing wrong? If I could at least get redirected, but with the 'email' and 'confirm email' fields pre-filled, that would at least be something.

I have checked, and I only have one active list....list number 3.

Any ideas?
damiantaylor
phpList newbie
 
Posts: 2
Joined: 2:08pm, Sun 22 Sep, 2013

Re: [how to] put a subscribe form on one of my website pages

Postby Dragonrider » 3:10pm, Sun 22 Sep, 2013

If you followed the instructions on the original doc's page about embedding a form, where's the javascript to check the input?

Also, you can only check for a single entry the way you have it set up.

You ask on the main page for their email address, BUT on your subscribe page you also ask for email confirmation, first and last names as well as gender but none of these are asked for initially, so they are not passed to your actual subscribe form thus it beings up the normal subscribe page.

The code on the very first page of this topic, 2nd post, works as is, still.

Code: Select all
<!-- newsletter subscribe below here -->

<script language="Javascript" type="text/javascript">
var fieldstocheck = new Array();
fieldnames = new Array();
function checkform() {
for (i=0;i<fieldstocheck.length;i++) {
if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
alert("Please enter your "+fieldnames[i]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
</script>

<form method="post" action="http://www.yourdomain.com/lists/?p=subscribe&id=1" name="subscribeform">
Email:<input type="text" name="email" value = ""><br>
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
Name: <input type="text" name="attribute2" value = "">
<script language="Javascript" type="text/javascript">addFieldToCheck("attribute2","Name");</script>
<input type="hidden" name="list[1]" value="signup" />
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">
</form>

<!-- newsletter subscribe ends here -->


Whereas your code is just:
Code: Select all
<div id="newsWrapper">
      <div id="newsContainer">
         <span>KEEP UP TO DATE WITH ALL THE LATEST NEWS & OFFERS</span>
         <form method="post" action="http://www.your domain.co.uk/newsletters?p=subscribe&id=3" name="subscribeform">
         <input type="text" name="email" value="" size="36">
         <input type="hidden" name="list[3]" value="signup">
         <input type="submit" name="subscribe" value="Subscribe">
         </form>
      </div>
   </div>

No javascript to check the email and only a single email request.

Try it and see, you'll even get a confirmation email (that you can ignore as the list is only a demo). My Embed Demo 1

If you also would like to try this version which asks for confirmation of email as well as your name AND opens the Thank you page in a popup window too.
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: [how to] put a subscribe form on one of my website pages

Postby damiantaylor » 5:52pm, Sun 22 Sep, 2013

Thanks for the response.
I didn't bother with the javascript check yet as I couldn't get the form working as I wanted.
I had a feeling the fact I wasn't supplying all the required fields was the reason I was being redirected.
I thought the email address entered on the first page would still carry across to the default subscribe page though.
damiantaylor
phpList newbie
 
Posts: 2
Joined: 2:08pm, Sun 22 Sep, 2013

Re: [how to] put a subscribe form on one of my website pages

Postby Dragonrider » 8:25pm, Sun 22 Sep, 2013

damiantaylor wrote:Thanks for the response.
I didn't bother with the javascript check yet as I couldn't get the form working as I wanted.
I had a feeling the fact I wasn't supplying all the required fields was the reason I was being redirected.
I thought the email address entered on the first page would still carry across to the default subscribe page though.

From what I read about this today, the idea is that you ask for the info you want on your Custom Subscribe Form that has to match what you ask on your Regular Subscription Form and doing so, lets you jump straight to the Thank you page.

Have a look at the two demo's I've just added to my test phpList 3 install and they go straight to the Thank you page. View Source to see how they work. It's all pretty much explained in the second post on the first page of the topic, that's where I started from today and combining with the amendments on the document page, put together the demo.
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: [how to] put a subscribe form on one of my website pages

Postby CThomas1972 » 1:44am, Sat 26 Oct, 2013

Dragonrider,

I visited:

"If you also would like to try this version which asks for confirmation of email as well as your name AND opens the Thank you page in a popup window too."

And I have been able to successfully duplicate it. Just a simple question: Is there any way to set all the values back to null after clicking the submit? The email, confirm, and name fields all turn blank again?

Thank you!
CThomas1972
phpList newbie
 
Posts: 2
Joined: 12:12am, Fri 25 Oct, 2013

Re: [how to] put a subscribe form on one of my website pages

Postby juanmi » 11:02am, Wed 06 Nov, 2013

Put this code on your web ;-)

Code: Select all
<html>
  <head>
    <title></title>
    <meta content="">
    <style></style>
  </head>
  <body>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
jQuery(function($) {
jQuery(document).ready(function(){
jQuery("#newsletter").submit(function(){
jQuery.ajax(
{
type: "POST",
url:"http://www.domain.com/lists/?p=subscribe&id=2",
data: $('#newsletter').serialize(),
success:function(result)
{
jQuery("#mensaje_ok").html("&#161;Succesfull!");
}
});
jQuery("#mensaje_ok").html("&#161;Succesfull!");
jQuery("#email").val("");
jQuery("#enviar").fadeToggle();
return false;
});
});
});
</script>

<div id="inserccion" style="float:left; border:0px solid; vertical align:middle;">
<form id="newsletter" method="" action="">
      <input type="hidden" name="VerificationCodeX" value="" />
      <input type="hidden" name="list[2]" value="signup">
      <input type="hidden" name="listname[3]" value="name_list"/>
      <input type="hidden" name="subscribe" value='subscribe'/>
      <span style="padding:0 5px 0 0; vertical-align: middle;">Newsletter:</span>
      <input type="text" style="" value="" size="20" name="email" id="email" placeholder="Your email here">
      <input class="button" type="submit" id="enviar" value="OK" name="submit">
</form>
</div>
<span id="mensaje_ok" style="float:left; padding: 6px 5px 0 5px;"></span>
</body>
</html>
juanmi
phpList newbie
 
Posts: 3
Joined: 10:40am, Wed 06 Nov, 2013

Re: [how to] put a subscribe form on one of my website pages

Postby devastor » 7:38pm, Thu 12 Feb, 2015

Hello,

i am a little disappointed, that such a great script has no good looking popup windows.

Is it not possible to simple add a blank popup window for error messages and confirmation?

Anyone know what i mean? I mean, a simple white popup window in a small window without a browser adress field.

I am missing that. Do that already exists?

Best Regards
Mathias

EDIT: I try this mod from version 2 now, to bring a custom thank you page up, which is still working for version 3.0.12. I think that is the best way - even better as popup windows. ;-)
devastor
PL Nut
 
Posts: 25
Joined: 9:46pm, Thu 05 Feb, 2015

Previous

Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron