Page 5 of 17

PostPosted: 1:26am, Mon 29 Jan, 2007
by H2B2
johnfrw wrote:*********************************************

The code <!-- CODE REMOVED FROM HERE--> was
<input type="hidden" name="list[2]" value="signup">
<input type="hidden" name="listname[2]" value="ASDW Mailing List"/>

*************************************************

You should add back this line between the <form ...> </form> tags:
Code: Select all
<input type="hidden" name="list[2]" value="signup">

Ref: http://docs.phplist.com/CustomSubscribeForm

PostPosted: 6:16pm, Mon 29 Jan, 2007
by johnfrw
H2B2

Thanks for the reply, I will try that.

cheers

PostPosted: 6:00pm, Sun 04 Feb, 2007
by H2B2
If a user forgets to select a list to subscribe to and clicks on the Submit button, he will be redirected to the default phplist subscribe page.

One way to avoid this from happening is to make the list pre-selected by adding "checked" to the corresponding input tag, e.g.:
Code: Select all
<input type="checkbox" name="list[1]" value="signup" checked />


Ref: http://forums.phplist.com/viewtopic.php?t=8226

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_ST

PostPosted: 8:52pm, Sun 04 Feb, 2007
by enchantedone
hi all i was hoping someone could give me a hand. i use zencart and i wanted to add a subscription box to my front page. i added the box but adding the code is giving me errors.

i originally put the code found in this thread then i got the html from the view source code for the subscription page. this is the error i get

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/user/public_html/includes/templates/template_default/sideboxes/tpl_mailinglist_sidebox.php on line 13

this is the code

Code: Select all

<?php
$content = '<center>


<!-- EDIT BELOW THIS LINE -->
<table align="center">


<script language="Javascript" type="text/javascript">

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;
}

var fieldstocheck = new Array();
var fieldnames = new Array();
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 name="subscribeform"><style type="text/css">
      div.adminmessage {
        width: 100%;
        border: 2px dashed #000000;
        padding: 10px;
        margin-bottom: 15px;
        background-color: #E7BE8F;

      }
      </style><div class="adminmessage"><p><b>You are logged in as administrator (enchante) of this phplist system</b></p><p>You are therefore offered the following choice, which your users will not see when they load this page.</p><p><a href="/newsletter/admin">Go back to admin area</a></p><p><b>Please choose</b>: <br/><input type=radio name="makeconfirmed" value="1"> Make this user confirmed immediately
      <br/><input type=radio name="makeconfirmed" value="0" checked> Send this user a request for confirmation email </p></div><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="attribute1"  class="attributeinput" size="40" value=""><script language="Javascript" type="text/javascript">addFieldToCheck("attribute1","Name");</script></td></tr>
</table><input type="hidden" name="list[2]" value="signup"><input type="hidden" name="listname[2]" value="Enchanted Lingerie"/><div style="display:none"><input type="text" name="VerificationCodeX" value="" size="20"></div><p><input type=submit name="subscribe" value="Add Me" onClick="return checkform();"></p>
    </form><br/><br/>
   

</table>

<!-- EDIT ABOVE THIS LINE -->


 


';
?>



this is the line im getting the error for


Code: Select all

if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {



i posted to the zencart forum a week ago and no one has offered any help, i was hoping someone could give me a hand.

thanks so much

cara

PostPosted: 2:10am, Mon 05 Feb, 2007
by H2B2
Your code is truncated. Edit your post, paste the code again and make sure you click on "Disable HTML in this post" on the left of your editing window.

PostPosted: 2:22am, Mon 05 Feb, 2007
by enchantedone
thanks for the reply. ok i edited the post and disabled html, i do not see a difference in the code though.

thanks :D

PostPosted: 2:35am, Mon 05 Feb, 2007
by H2B2
The difference is that the form and input tags are fully displayed now.

Unfortunately that doesn't help me seeing what the problem coulde be. You might be better off with a search through the internet for the error message, e.g. http://www.experts-exchange.com/Web/Web ... 68726.html

PostPosted: 2:43am, Mon 05 Feb, 2007
by enchantedone
thanks for trying, i will give it a shot. i did try searching but wasn't coming up with anything i will try your link and do more searching.
i couldn't see what the problem was either, i though for sure it would be something stupid i overlooked.

again thanks i appreciate you looking

Cara

Thank You Page

PostPosted: 10:50pm, Sun 11 Feb, 2007
by OrangeUFO
I have successfully setup my custom signup page for my newsletter. Now l want to be able to have my own custom thank you page.

How is this possible?

PostPosted: 9:09am, Fri 16 Feb, 2007
by TiferTwo
Hopefully this will help someone out there!

I've been setting up a custom subscribe form within the homepage of my site, and was finding that if a required field was not entered or the email addresses didn't match (i.e. the javascript warning kicked in), then the form was being submitted, and the main subscribe page was displaying - albeit with the fields filled in as previously. This was only happeneing in IE - Firefox worked fine.

After lots of nitpicking on html syntax to no avail, I tried changing the javascript function call around.

As standard, it goes as an onclick event on the submit button, so I tried moving it to an onsubmit event on the form itself instead - BINGO!


So it was like this:
Code: Select all
<form method="post" name="subscribeform" action="/phplist/?p=subscribe">

   [insert all the rest of the form fields here]

   <input type="submit" name="subscribe" value="Subscribe" onclick="return checkform();" />
</form>


Now it's like this:
Code: Select all
<form method="post" name="subscribeform" action="/phplist/?p=subscribe" onsubmit="return checkform();">

   [insert all the rest of the form fields here]

   <input type="submit" name="subscribe" value="Subscribe" />
</form>


All seems to work OK in FF and IE. Any negatives anyone can think of?

PostPosted: 8:17pm, Fri 23 Feb, 2007
by H2B2
TiferTwo,

Seems like a good solution to me. Thanks for sharing!

No success - straight back to /lists/?p=subscribe

PostPosted: 3:14am, Tue 20 Mar, 2007
by neopurple
Hi,

I'm not exactly a phplist tyro, but not expert, either. I've read this thread from beginning to end, so I know that this question isn't new, but I'm stuck. My custom page just sends users to the default phplist subscribe page on submit. I think I've followed all instructions correctly. Here's the JavaScript (taken from the phplist-generated version on the page):

Code: Select all
<script language="Javascript" type="text/javascript">
         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;
               }
            }
         
            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;
         }
         
         function compareEmail()
         {
            return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
         }
      </script>


Here's the form definition (note that I've followed the suggestion made just above re: using onSubmit instead of onClick) Also, i can't post URLs, so I had to use a meta URL <mydevserver>:

<form method="post" action="<mydevserver>/lists/?p=subscribe" name="subscribeform" onSubmit="return checkform();">

Here's the hidden field (note I'm using full quotes, as suggeted):

<input type="hidden" name="list[2]" value="signup">

I have searched for, found and removed the following line:

<input type="hidden" name="listname[2]" value="test"/>

on submitting the form, users end up at: <mydevserver>/lists/?p=subscribe

This looks just the phplist default subscribe page for this list (all form fields are filled in) although the URL for that would be <mydevserver>/lists/?p=subscribe&id=2. This happens on IE7 and Firefox.

No doubt I am missing something, but I'm blind to it. Any help greatly appeciated.

PostPosted: 2:27pm, Thu 22 Mar, 2007
by H2B2
It might help to have a closer look at the source code. Could you post the url to your subscribe page?

Custom Thank You Page

PostPosted: 6:02am, Tue 27 Mar, 2007
by scarecrow1
Really interested in getting guidance on OrangUFO's question:

I have successfully setup my custom signup page for my newsletter. Now l want to be able to have my own custom thank you page.

How is this possible?

PostPosted: 12:52am, Fri 30 Mar, 2007
by H2B2
You could use a meta refresh tag to redirect to a page of your choice. Alternatively you could change the code as suggested in this post: viewtopic.php?p=29679#29679