Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi! What I've done is copy the html source code into a custom block as follows:
><form accept-charset="UTF-8" action="/" id="simplenews-subscriptions-page-form" id="simplenews-block-form-32" method="post">
<div><div class="form-type-textfield form-item-realname form-item form-group">
<label for="edit-realname">Name <span class="form-required" title="This field is required.">*</span></label>
<input type="text" id="edit-realname" name="realname" value="" size="20" maxlength="255" class="form-text required" />
</div>
<button class="btn btn-default form-submit" id="edit-submit" name="op" value="Subscribe" type="submit">Subscribe</button>
<input type="hidden" name="form_build_id" value="form-d1sWPN54e_cfYPe1hXkOpQQsH2ibEuW7bfTUTdie3S4" />
<input type="hidden" name="form_token" value="Vht2yfEoSBhRS7fnw08bBED_z6jvc0v-xZ5b3u4tJUM" />
<input type="hidden" name="form_id" value="simplenews_block_form_32" />
</div></form>
which works perfectly. But what I would like is that on submit the person gets redirected to a specific thank you page. When I change action="/"
to example
action="/thank-you"
the user does not get added to the list.
Would most most appreciate any suggestions or guidance :)
Comments
Comment #1
Liliplanet CreditAttribution: Liliplanet commentedComment #2
Liliplanet CreditAttribution: Liliplanet commentedComment #3
Liliplanet CreditAttribution: Liliplanet commentedSorted with Rules! If user has subscribed, select data comparison, selected data is tid equals your newsletter taxonomy, add action.
Would have been easier if it was possible in the form, but super happy.
Comment #4
Proteo CreditAttribution: Proteo commentedA bit late, but I just had to do something very similar and wanted to share my solution. I've placed a Simplenews block in the footer (globally), and by default the module will reload the same page after the form has been submitted. This has to drawbacks:
a) All the feedback the user will see after submitting the form is a message at the top of the page (or wherever you placed messages in your template), so it may pass unnoticed.
b) We use Varnish for page caching, so these messages simply won't appear when the page is already cached (which is true 90% of the times). The registration itself works fine, but the user just won't have any feedback, so many users will submit the form repeatedly and will receive multiple confirmation messages.
So I wanted to:
a) Be able to craft a page specifically to inform users about the result of the submission –if it was valid, they would see a page, and a different one if not–.
b) Redirect all form submissions to a custom page with a fixed URL that can be excluded from the cache.
This is what I did:
1. Create two pages, one for successful submissions and other for the failed ones. How to do that and what to put in them, is up to you. You can create two nodes, or create to Panels pages, or whatever works for you. Just make sure you have two working URLs.
2. Create a custom module and put these functions in it. Don't forget to change the relevant bits accordingly:
Comment #5
vrwired CreditAttribution: vrwired commentedI had to bring some code more up to date but the above was useful in figuring it out. Here's another basic example: