I have a form where I can choose email address to send to.
Otherwise to give URL where to send the form.
Is it somehow possible to use this form?
I tried to send this to url. https://www.list.istok.de/lists//index.php?p=asubscribe&id=3
but https://www.list.istok.de/lists. shows nothing only: https://www.list.istok.de shows public lists.
Please help me to bring this form to work as for example on https://beauty.istok.de/
It should work for not public list
@dreamcreator Is the idea that someone would enter their email address, click the button, and remain on that page? In that case you need to use the AJAX approach explained in the manual Creating a subscribe page | phpList manual in the section “Add an AJAX subscribe box on your website”.
You will need to create a subscribe page with just one public list to hold the people who respond in this way. The example code doesn’t support using an attribute, such as Name.
An alternative way is to transfer the person away from your website to phplist and let them complete the form there. You can create a new subscribe page with just one list.
Not needed, i just want to send this form even if page refreshes. Even only with only email field.
Unfortunately I don’t understand princip of public lists and subscribe pages.
I have now main page with 3 public lists and it should be stay so. list.istok.de
list.istok.de/lists shows nothing
Now I want to have possibilty to subscribe to list which is not public or somehow to make this subscription separate (with other page)
How to have something like this? https://installationname.yourdomain.com/lists/?p=subscribe&id=1
You cannot do that. If you are offering a subscribe form then the list needs to be public. If you have a private list then you need to add subscribers manually yourself.
No, there are four subscribe pages, with ids of 1, 2, 3, and 7. Subscribe pages 1, 2, and 3 appear to offer only one list each, while subscribe page 7 offers all three lists.
What do you want to happen when the person submits? Stay on your web site or go to the phplist page? The first is the AJAX approach, the second you need a URL to a new subscribe page that has only one list
You could try https://list.istok.de/?p=subscribe&id=999
where 999 is the id of a new subscribe page that offers a new list.
The 7th is now added because I am trying to get these 3 separate from another one. I have about 30 lists and don’t want to have them all listed on main page list.istok.de
In this ajax code there is a code https://installationname.yourdomain.com/lists/?p=subscribe&id=1
Why adapted url shows nothing? Sometimes I see subscribe sometimes asubscribe in codes
I want to stay on page after sending form
Then you need to use the AJAX approach. The URL will be https://list.istok.de/?p=asubscribe&id=999
where 999 is the id of a new subscribe page that offers a new list. There is an error in the sample code that uses p=subscribe
Sorry, we were unable to process your subscription. each tome by using this ajax code.
https://list.istok.de/?p=asubscribe&id=2. is what I used
To see in right bottom menu on:
https://rainbowsongs.org/we-are-an-old-family-we-are-a-new-family/
I ask me why on startpae are still only 3 lists to see even if I made others public?
I just saw emails to confirmation.
But dont know why each time the failure alert is coming when sending form.
But after confirming:
Thank you for confirming your subscription to our newsletters. The newsletters you are subscribed to are listed below
- None of them
Subscribe to our Newsletters works as page but not as you wrote by ajax code
url: ‘https://list.istok.de/?p=asubscribe&id=2’, dataType: ‘html’, success: function (data, status, request) {
Whereabouts have you added the code? It does not appear in beauty.istok.de
and I don’t understand what this other site is https://rainbowsongs.org/we-are-an-old-family-we-are-a-new-family/
phplist has a concept of a subscribe page which offers one or more lists. You can find an explanation of a subscribe page in the manual Creating a subscribe page | phpList manual
You currently have four public subscribe pages
id 1 signs up to list id 3 with name EKIW
id 2 signs up to list id 4 with name ACIM
id 3 signs up to list id 5 with name KURS
id 7 signs up to list id 10 with name “How to Get Anything You Want”
I don’t understand what you are trying to do - whether use one of these subscribe pages or whether to create a new one.
If you don’t understand this idea then you may just have to leave this.
Blockquote
Email |
Blockquote
I dont know how to send code here.
This is ajax code which you sent (with corrected url). I just test it in widget first. But there is a failure popup. Rainbowsongs is just site from me where I placed this code to test this.
https://list.istok.de/?p=asubscribe&id=7. seems not to work properly
beauty.istok.de is squize page where I finally want to place functioning form which did not have worked till now.
I use this first 3 lists since about 10 years with 3 x 360 daily emails and it works so I hope to find a way to use also other lists too. just grabbing an email seems to be complicate.
@dreamcreator Where can I see the code that you have added?
Try adding this to config.php using the sites where you want to add the subscribe form
/
// For ajax based signup forms (https://discuss.phplist.org/t/solved-ajax-subscribe-api/974) the access-control-allow-origin header
// has to be set properly.
// Add the addresses of the websites you want to allow to perform ajax requests to PHPList.
define('ACCESS_CONTROL_ALLOW_ORIGINS', ['https://example.com','https://example.org']);
I did via ftp as on site it is not possible to edit
the same failure: Sorry, we were unable to process your subscription.
that is ajax code (I dont know hot to quote this without beeing procedere)
@dreamcreator I mean which web site can I look at to see the code?
Use the toolbar code button </> when you are copying code.
Please show the line that you added to the config.php file.
As you wrote:
define(‘ACCESS_CONTROL_ALLOW_ORIGINS’, [‘https://istok.de’,‘https://rainbowsongs.org’]);
You didn’t answer this question. I cannot see the subscribe form on rainbowsongs.org
Sorry but I don’t think that I can help any more with this.
sorry I didnt get an eamil about answer.
I wrote before on rainbowsongs it is on each song post in bottom right menu
here f.e.
https://rainbowsongs.org/we-are-an-old-family-we-are-a-new-family/
the last widget in right menu
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<form method="post" name="subscribeform" id="subscribeform" enctype="multipart/form-data"> <table border=0> <tr> <td><div class="required">Email</div></td> <td class="attributeinput"><input type=text name="email" value="" id="email" size="40"></td> </tr> </table> <input type=hidden name="htmlemail" value="1"> <input type="hidden" name="list[11]" value="signup" /> <input type="hidden" name="subscribe" value="subscribe"/> <button class='button' onclick="if (checkform()) {submitForm();} return false;" >Subscribe</button> <div id="result" style="color: red;"></div> </form>
<script type="text/javascript"> function checkform() { re = /^\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{2,3})+$/; if (!(re.test(jQuery("#email").val()))) { jQuery("#result").empty().append("Please enter a valid email address"); jQuery("#email").focus(); return false; } return true; } function submitForm() { successMessage = 'Thank you for your registration. Please check your email to confirm.'; data = jQuery('#subscribeform').serialize(); jQuery.ajax( { type: 'POST', data: data, url: 'https://list.istok.de/?p=subscribe&id=999', dataType: 'html', success: function (data, status, request) { jQuery("#result").empty().append(data != '' ? data : successMessage); jQuery('#email').val(''); }, error: function (request, status, error) { alert('Sorry, we were unable to process your subscription.'); } }); } </script>
With this code above I cand send a form, I see confirmation of sendinf.
After I get 2 emails. I confirm clicking a link but get an answer:
Thank you for confirming your subscription to our newsletters. The newsletters you are subscribed to are listed below
- None of them
But in form is a page 7 linked with list id 10