[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: Firefox x Internet Explorer

Postby H2B2 » 11:33pm, Tue 04 Mar, 2008

leozeferino wrote:I putted my page in HTML 4.01 Transitional but the error is the same. In Firefox, function normally, but in IE the page /lists/?p=subscribe opens. Why?
If the custom form has a missing required value, or if there is an incompatibility with the HTML/CSS/Javascript versus doc type and/or what the browser finds acceptable, the script will fall back on the default phplist subscribe page.

You could use the W3.org validators to check the whole subscribe page for possible (syntax) errors: http://www.w3.org/QA/Tools/#validators
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: Firefox x Internet Explorer

Postby leozeferino » 1:16am, Wed 05 Mar, 2008

H2B2 wrote:If the custom form has a missing required value, or if there is an incompatibility with the HTML CSS Javascript versus doc type and or what the browser finds acceptable, the script will fall back on the default phplist subscribe page.

You could use the W3 validators to check the whole subscribe page for possible (syntax) errors.


H2B2,

I don't know what I can do more.
- My page is OK in W3. I tested in the validator.
- My DOC TYPE is HTML 4.01 Transitional.
- The code functions in Firefox!!

What can I do to code function in IE?
The page to test is w w w . r e v i s t a j u s t i t i a . c o m . b r / l i n k s / n e w s l e t t e r . p h p


Thanks a lot for help!
leozeferino
phpLister
 
Posts: 7
Joined: 5:41pm, Sat 16 Feb, 2008

Postby H2B2 » 2:02am, Wed 05 Mar, 2008

I tested the page in IE6. It works fine *IF* you allow ActiveX controls. So I suggest you look into this and check if disabling some of the scripts on that page make a difference or not.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Simple phplist subscription form in sidebox

Postby dealbyethan » 11:02am, Tue 18 Mar, 2008

Hi,

I am trying to get the following code that displays a simple phplist subscription form with an email address field and subscribe button to integrate and work properly in a sidebox on my website. I keep getting this error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

I checked through the php file (see below) and couldn't locate the error. Can anyone please help? Thanks.

Code: Select all
<?php

  $content = '';
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';

  $content .= '<p>' . TEXT_BLANK_SIDEBOX . '</p>';
  $content .= '<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;
}

function compareEmail()
{
  return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
}

</script><form method=post action="WEBSITE_URL/newsletters/?p=subscribe" name="subscribeform" target="windowName" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');"><style type="text/css">
      div.adminmessage {
        width: 100%;
        border: 2px dashed #000000;
        padding: 10px;
        margin-bottom: 15px;
        background-color: #E7BE8F;

      }
      </style>

Email:
<input type=text name=email value="" size="15">
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email");</script>

<input type="hidden" name="list[3]" value="signup"><input type="hidden" name="listname[3]" value="Mens Clothing"/><input type=submit name="subscribe" value="Subscribe" onClick="return checkform();">
    </form>';

  $content .= '</div>';
?>

Last edited by dealbyethan on 12:21pm, Tue 18 Mar, 2008, edited 1 time in total.
dealbyethan
phpList newbie
 
Posts: 4
Joined: 1:44am, Sun 10 Feb, 2008

Postby dealbyethan » 11:15am, Tue 18 Mar, 2008

It looks like the code I just showed is not showing properly. I can't attach a file either. How can I show you the code?
dealbyethan
phpList newbie
 
Posts: 4
Joined: 1:44am, Sun 10 Feb, 2008

Postby H2B2 » 12:05pm, Tue 18 Mar, 2008

dealbyethan wrote:It looks like the code I just showed is not showing properly. I can't attach a file either. How can I show you the code?
Edit your previous message, paste the code again and make sure you select the "Disable HTML in this post" checkbox on the left of your editing window.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby dealbyethan » 12:22pm, Tue 18 Mar, 2008

Yup, I have done that. Have a look and let me know what I did wrong. Thanks.
dealbyethan
phpList newbie
 
Posts: 4
Joined: 1:44am, Sun 10 Feb, 2008

Postby H2B2 » 1:33pm, Tue 18 Mar, 2008

I just checked on your site.

This is the standard form code phplist (ver. 2.10.2 in your case) generates, reduced to basics for clarity:
Code: Select all
<form method=post name="subscribeform">
<input type=text name=email value="" size="40">
<input type=radio name="htmlemail" value="0"  />
<input type=radio name="htmlemail" value="1" checked />
<input type="hidden" name="list[3]" value="signup">
<input type="hidden" name="listname[3]" value="Mens Clothing"/>
<input type=submit name="subscribe" value="Subscribe" onClick="return checkform();">
</form>


This is what you currently have as your custom form:
Code: Select all
<form method=post action="WEBSITE_URL/newsletters/?p=subscribe" name="subscribeform" target="windowName" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');">
<input type=text name=email value="" size="15">
<input type="hidden" name="list[3]" value="signup">
<input type="hidden" name="listname[3]" value="Mens Clothing"/>
<input type=submit name="subscribe" value="Subscribe" onClick="return checkform();">
</form>


This is what I think you should have done based on the phplist generated code, as explained in the docs:
Code: Select all
<form method="post" action="WEBSITE_URL/newsletters/?p=subscribe" name="subscribeform" target="windowName" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');"
/>
<input type="text" name="email" value="" size="15" />
<input type="radio" name="htmlemail" value="0"  />
<input type="radio" name="htmlemail" value="1" checked />
<input type="hidden" name="list[3]" value="signup" />
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();" />
</form>
Note the added double quotes, ending slashes and more importantly the added input tags for html/text format radio buttons which phplist expects to be specified, as this is what you 'told' phplist to expect when you configured your subscribe form in the admin module. If you don't want the radio buttons, you should first configure this in phplist ("don't offer choice, default to HTML"), and only then can you leave them out in your custom form.

dealbyethan wrote:Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
The above changes may not fix this syntax error. I suggest you review your php syntax, as it might just be a matter of a missing semi colon or quote somewhere, like in this case for example: http://www.webmasterworld.com/php/3276863.htm
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby dealbyethan » 2:04pm, Tue 18 Mar, 2008

Hi,

Thanks for your suggestion. It was close. The problem was with the following code. Once removed, it shows up. Is the code problematic? Is there any other way to enable a pop-up window when someone subscribes?

Code: Select all
target="windowName" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');"
dealbyethan
phpList newbie
 
Posts: 4
Joined: 1:44am, Sun 10 Feb, 2008

Postby H2B2 » 2:21pm, Tue 18 Mar, 2008

Glad you found the culprit.

Can't answer your question I'm afraid. Instead of a popup, you might consider redirecting to a page of your choice. You could take a look at this mod provided by spamcollect: http://forums.phplist.com/viewtopic.php?t=16808
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

awesome!!

Postby daveryder » 2:26pm, Thu 27 Mar, 2008

dude, that is awesome, I loves it

had it up and working in like 5 minutes

wow what a great job thanxs 4 the gumball

:D :D 8) 8)
daveryder
phpList newbie
 
Posts: 1
Joined: 2:22pm, Thu 27 Mar, 2008

Postby aaronius » 4:32am, Fri 04 Apr, 2008

Greetings,

Following the helpful instructions I was successfully able to get a custom subscribe page working on my website. However, I have two different lists and would like people to be able to subscribe to either or both with the same form. The relevant section of code I'm using looks like this:

Code: Select all
<input type="checkbox" name="list[2]" value=signup checked> Blue Lacuna News and Updates<br>
<input type="checkbox" name="list[3]" value=signup> Blue Lacuna Beta Testing<br>


Unfortunately "beta" is always subscribed to, even if it is not selected. (If "news" alone is selected or both options are selected, both lists are subscribed to.)

I thought at first this was related to the default list, but the default list is actually "news."

You can see this in context at lacunastory dot com/mailing-lists2.html

Any help would be greatly appreciated! Thanks in advance.

--Aaron
aaronius
phpList newbie
 
Posts: 1
Joined: 4:24am, Fri 04 Apr, 2008

Postby H2B2 » 5:32am, Fri 04 Apr, 2008

This section of the docs might apply:
If you only offer just one single list (e.g. one newsletter) in your subscribe form, check you have this hidden input tag in your form (where x is the ID number of the list):
Code: Select all
<input type="hidden" name="list[x]" value="signup">

However, if you offer more than one list in your subscribe form, make sure you remove
the above input tag.
Ref: http://docs.phplist.com/CustomSubscribeForm
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby jzero » 5:29pm, Tue 29 Apr, 2008

For Freishwimmen and others experiencing the problem with custom attributes disappearing when the user submits, I believe the fix is:
The setting "The default subscribe page when there are multiple" must equal the number of the subscribe page that has the attributes defined. In my case, I had to change it from the default (1) to 2.
jzero
phpList newbie
 
Posts: 3
Joined: 7:37pm, Sun 27 Apr, 2008

bad form action

Postby ed.advertise » 1:43pm, Mon 05 May, 2008

Hello,
i made my custom page and when i click on the button to send the form, the action adress is wrong..
It goes to mydomain/domainlist/...

mydomain is the adress where the form is and the action shoould be only domainlist/...

Does anybody know, where is the problem?
ed.advertise
phpLister
 
Posts: 14
Joined: 2:55pm, Wed 12 Mar, 2008

PreviousNext

Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests