2 |
15 |
--------------------------------------------------------------------------------
/locale-save.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/change-error-text-for-a-single-field.html:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/update-field-with-another-field's-value.html:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/tls-checker.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/disable-submit-until-target-message-keypress.html:
--------------------------------------------------------------------------------
1 |
12 |
24 |
--------------------------------------------------------------------------------
/placeholders.html:
--------------------------------------------------------------------------------
1 |
24 |
--------------------------------------------------------------------------------
/phone-mobile-number-hidden-email-address.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
11 |
18 |
--------------------------------------------------------------------------------
/opt-in-text-toggle.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/textarea-characters-remaining.html:
--------------------------------------------------------------------------------
1 |
25 |
--------------------------------------------------------------------------------
/currency-symbol-next-suggested-gift.js:
--------------------------------------------------------------------------------
1 | // NOTE: this requires the jQuery library
2 | // The Next Suggested Gift can change the radio donation amounts on a donation page
3 | // But it loses the currency symbol. This code adds the currency symbol (set as £ in this example)
4 | // to the amount label, if the first character is a number (e.g. "10" becomes "£10" but "£20" or "Other" stays the same)
5 | // setTimeout is needed to ensure this code runs after the NSG has done what it needs to do
6 |
27 |
--------------------------------------------------------------------------------
/ett-target-block-show-target-party.js:
--------------------------------------------------------------------------------
1 | // Grab political party / other data from biography and insert it after the last name of the contact
2 | // For this to work, you need to insert the party as a field insert into the target block's biography tab
3 | $(document).ready(function(){
4 | // Hide the biography tab
5 | $('.en__contact--open .en__contactDetails__background, .en__contacts--singleMessageMode .en__contactDetails__background').css("display", "none"); // one message to all contacts - update if individual msgs
6 | // Insert party
7 | $('.en__contacts').children('.en__contact').each(function () {
8 | var contactId = this.getAttribute('data-contact');
9 | contactId = String(contactId);
10 | var temp = ".en__contact--"+contactId;
11 | var selector = temp + " .en__contactBackground__text";
12 |
13 | var contactParty = $(selector).text();
14 | contactParty = contactParty.replace(" ", ""); // strip extra spaces
15 |
16 | $(temp + ' .en__contactDetail--lastName').append('-'+contactParty+'');
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/anonymous-random-email-address.html:
--------------------------------------------------------------------------------
1 |
24 |
--------------------------------------------------------------------------------
/display-recent-responses-to-questions.md:
--------------------------------------------------------------------------------
1 | You can use our public API call to retrieve, and display, responses to a question directly on the page.
2 |
3 | To do this, you need to add a Code Block, with code similar to the below. Note that you'll need to get your own Public Token for the token variable, and to place in your own questionId. The questionId can be retrieved by following the instructions at the bottom of https://engagingnetworks.support/knowledge-base/public-data-services-using-a-token
4 |
5 | ```html
6 |
7 |
32 | ```
33 |
--------------------------------------------------------------------------------
/share-by-email-button.md:
--------------------------------------------------------------------------------
1 | # Add a share by email button to the simple social buttons
2 |
3 | The social share channels available are Facebook, Twitter, LinkedIn and WhatsApp. But what if you wanted to add another option to share by email here?
4 |
5 | If you add this code to the bottom of the page, below the social buttons then it'll do this for you. Adjust the settings for the email variables for your own content:
6 |
7 | Remember to add to the code if you have not already loaded the jQuery library
8 |
9 | ```html
10 |
26 |
--------------------------------------------------------------------------------
/reference-and-target-data-in-a-text-block.md:
--------------------------------------------------------------------------------
1 | Reference data and target data (such as Party) can be inserted inside a target block message, in the contact details area of a target block, or in the background information tab of the block.
2 |
3 | If you wish for reference data to show up in a text block then you can insert this into the background information area of the target block first, then use the following code to display it in a text block as well (hiding the background information tab too).
4 |
5 | This code works for a three-page email-to-target campaign set-up, where the target block is on Page 2.
6 |
7 | 1) Add any html, target data inserts and reference data inserts you want to display inside the targetblock's background information area (via the target block's settings) first.
8 | For example:
9 | ```html
10 |
In {contact_data~organization}, there are {reference_data~123~column1} cases of graffiti every year.
11 | ```
12 | 2) Add a Code Block at the bottom of the page with the following code (this assumes you have jQuery on your page):
13 | ```html
14 |
17 |
22 | ```
23 | 3) Add a class of "referencemessage" to the text block that should display the html (it will replace everything inside the text block so you can add default text here should the code not work for some reason)
24 |
--------------------------------------------------------------------------------
/progress-through-campaign-pages.md:
--------------------------------------------------------------------------------
1 | # Show progress through the campaign
2 | This is useful to give an indication of how far through the campaign the supporter is.
3 | For example, for a donation campaign, page 1 might be "Personal Details", 2 "Payment details" and 3 "Confirmation".
4 | This is very simple by using a text block on each page:
5 |
6 | ```html
7 |
8 |
Details
9 |
Payment
10 |
Complete
11 |
12 | ```
13 |
14 | Note that the "active" class shows the current stage in the process.
15 |
16 | An example style is below - this changes the numbers into circles and adds an underline in the submit button's colour (if using the Free and Flexible templates):
17 |
18 | ```css
19 | /* Page progress */
20 | .progress ol {
21 | padding: 0;
22 | display: flex;
23 | width: 100%;
24 | list-style: none;
25 | counter-reset: item;
26 | }
27 | .progress ol li {
28 | width: 33%;
29 | font-weight: bold;
30 | border-bottom: 3px solid #dddddd;
31 | padding-bottom: 14px;
32 | list-style-position: inside;
33 | counter-increment: item;
34 | text-align: center;
35 | }
36 | .progress ol li.active {
37 | border-bottom: 3px solid var(--submit__button_background-color);
38 | color: var(--submit__button_background-color);
39 | }
40 | .progress ol li::before {
41 | content: counter(item);
42 | margin-right: 5px;
43 | background-color: #aaa;
44 | border-radius: 100%;
45 | color: #ffffff;
46 | width: 24px;
47 | display: inline-block;
48 | text-align: center;
49 | }
50 | .progress ol li.active::before {
51 | background-color: var(--submit__button_background-color);
52 | }
53 | ```
54 |
--------------------------------------------------------------------------------
/direct-debits-next-two-possible-dates.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
45 |
--------------------------------------------------------------------------------
/account-number-sort-code-verify.md:
--------------------------------------------------------------------------------
1 | # Verify account number and sort code
2 |
3 | You cannot insert some field values into thanks emails or on thanks pages. For example, tagged account number and sort code.
4 | Therefore if you want to verify these to the supporter, you need to create new untagged fields in your Account Data Structure
5 | and add them to the form block as Hidden fields. You can then use a Code Block to update these fields with the data that
6 | the supporter enters.
7 |
8 | **Note:** how you verify supporter's financial information with them is up to you and depends on many factors - we do not offer advice on what you should do, just the technical aspect of it. The code below is simply an example.
9 |
10 | In this example, the code block will update the untagged fields NOT_TAGGED_13 and NOT_TAGGED_14 with the tagged fields.
11 | Your own IDs may vary.
12 |
13 | In addition, the code masks out the first 4 digits of the account number.
14 |
15 | ```html
16 |
31 | ```
32 |
33 | Now you can simply use the field insert tool to display this information to the supporter.
34 |
--------------------------------------------------------------------------------
/whatsapp-legacy.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
38 |
--------------------------------------------------------------------------------
/searchable-selects.md:
--------------------------------------------------------------------------------
1 | If you have a lot of values in a select field, you might want it to be fully searchable.
2 |
3 | There is a third-party JavaScript plug-in called [Selectize](https://github.com/selectize/selectize.js) that works well.
4 |
5 | ## Example
6 | For example, this allows you to search for specific UK towns:
7 |
8 | https://secure.engagingnetworks.net/page/47877/petition/1?mode=DEMO&locale=en-GB
9 |
10 | In that example, it uses a code block to call CDN files (this applies to all Selects - you can change this to be more specific via the .selectize() line in this code):
11 |
12 | ```html
13 |
14 |
15 |
16 |
21 | ```
22 |
23 | There are many other options available, so check out Selectize's documentation.
24 |
25 | ## Styling
26 |
27 | Some example stylings for the selectize box:
28 |
29 | ```css
30 | .selectize-input input {
31 | border-radius: .5em;
32 | color: #264334;
33 | min-height: 3em;
34 | padding: .55em !important;
35 | border-color: #000;
36 | }
37 | ```
38 |
39 | To make it full width:
40 |
41 | ```css
42 | .selectize-control {
43 | width: 100%;
44 | padding: 0;
45 | }
46 | ```
47 |
48 | And to style the search text (highlight) and the active one you hover on (active):
49 |
50 | ```css
51 | .selectize-control .highlight {
52 | color: white;
53 | background-color: #333333 !important;
54 | }
55 | .selectize-control .active {
56 | background-color: #ccc;
57 | }
58 | ```
59 |
60 | And to style the placeholder text:
61 |
62 | ```css
63 | .selectize-control input::placeholder {
64 | color: black;
65 | }
66 | ```
67 |
68 |
--------------------------------------------------------------------------------
/insert-today's-date.js:
--------------------------------------------------------------------------------
1 | $( document ).ready(function() {
2 | // this example:
3 | // ... inserts today's date into #en__field_supporter_NOT_TAGGED_6,
4 | // ... inserts the date a year from now into #en__field_supporter_NOT_TAGGED_8,
5 | // ... inserts the date a year from now, minus one, into #en__field_supporter_NOT_TAGGED_7
6 | // It will format them as YYYYMMDD which means you can use profile and query filters (e.g. Is After)
7 | // Note 1: the IDs of the fields you want to insert the dates into will be different for your own account!
8 | // Note 2: the fields would need to be on the page, and hidden by CSS (NOT as a Hidden type otherwise val cannot be set)
9 | // Note 3: Hide the fields using CSS in a code block so you can still see them in page-builder
10 | // Note 4: You don't need all three fields of course - if you just want today's date, only insert for the start date
11 | // Note 5: You need jQuery for this to work. You can put this in a Code Block on the same page as the fields to insert into
12 |
13 | var daytoday = new Date();
14 | var dayinyear = new Date();
15 | var dayinyearlessone = new Date();
16 | dayinyear.setFullYear(dayinyear.getFullYear() + 1);
17 | dayinyearlessone.setFullYear(dayinyearlessone.getFullYear() + 1);
18 | dayinyearlessone.setDate(dayinyearlessone.getDate()-1);
19 | $("#en__field_supporter_NOT_TAGGED_6").val(formatDate(daytoday)); // today's date (e.g. start date)
20 | $("#en__field_supporter_NOT_TAGGED_7").val(formatDate(dayinyearlessone)); // date a year from now, minus one (e.g. end date)
21 | $("#en__field_supporter_NOT_TAGGED_8").val(formatDate(dayinyear)); // date a year from now (e.g. due date)
22 | function formatDate(date) {
23 | var year=String(date.getFullYear());
24 | var month=String(date.getMonth() + 1);
25 | var day=String(date.getDate());
26 | if (month.length < 2) {
27 | month = "0" + String(month);
28 | }
29 | if (day.length < 2) {
30 | day = "0" + String(day);
31 | }
32 | var formattedDate=String(year)+String(month)+String(day);
33 | return formattedDate;
34 | }
35 | });
36 |
--------------------------------------------------------------------------------
/ETT-select-random-target-from-custom-database.md:
--------------------------------------------------------------------------------
1 | # Select a random target for a custom database ETT
2 |
3 | Usually when using a custom database that requires a Match field, you match the target
4 | on a field determined by the supporter, e.g. their broadband company
5 |
6 | However, you may want to randomise this, so that the supporter is given a randomised target from a list of targets.
7 |
8 | This is especially useful for the UK's House of Lords database, since these aren't determined by a postcode.
9 |
10 | 1) Create your custom database as usual, with a column of match numbers from 1 upwards, so each row has a unique number
11 | 2) Create a match field in your account data structure that will hold the randomised match number
12 | 3) Add the field to your ETT's first page, and the target block on the 2nd page
13 | 4) Add the code block below, ensuring you amend num to be the total number of targets in your database
14 | 5) Also amend matchFieldID to be the ID of your field (you can see this in the HTML of your page)
15 |
16 |
17 | ```html
18 |
49 | ```
50 |
--------------------------------------------------------------------------------
/direct-debits-next-two-possible-dates-v2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
67 |
--------------------------------------------------------------------------------
/accessible-custom-checkboxes.css:
--------------------------------------------------------------------------------
1 | /* Styling checkboxes can often make them inaccessible with either the keyboard, screenreaders, or even both.
2 | This CSS allows you to replace the default browser checkboxes with fully accessible replacements.
3 | There are comments which indicate which parts to change to customise for your brand. */
4 |
5 | input[type='checkbox'] {
6 | position: absolute;
7 | }
8 |
9 | input[type='checkbox'] + label {
10 | display: block;
11 | position: relative;
12 | padding: 0 1.5rem;
13 | }
14 |
15 | input[type='checkbox'] + label::before {
16 | content: '';
17 | position: relative;
18 | display: inline-block;
19 | margin-right: 10px;
20 | width: 25px; /* Modify this to change the size of the checkbox. */
21 | height: 25px; /* Modify this to change the size of the checkbox. */
22 | background: #ffffff; /* Modify this to change the background colour of the checkbox. */
23 | border: 1px solid #000000; /* Modify this to change colour of the border of the checkbox and the thickness of the border. */
24 | vertical-align: text-bottom;
25 | }
26 |
27 | input[type='checkbox']:checked + label::before {
28 | background: #ffffff; /* Modify this to change the colour of background of the checkbox when it is checked. */
29 | }
30 |
31 | input[type='checkbox']:checked + label::after {
32 | content: '';
33 | position: absolute;
34 | top: 7px; /* Modify this to adjust the position of the tick inside the checkbox. */
35 | left: 22px; /* Modify this to adjust the position of the tick inside the checkbox. */
36 | border-left: 2px solid #000000; /* Modify this to change the colour of the tick inside the checkbox. */
37 | border-bottom: 2px solid #000000; /* Modify this to change the colour of the tick inside the checkbox. */
38 | height: 6px; /* Modify this to change the size of the tick inside the checkbox. */
39 | width: 13px; /* Modify this to change the size of the tick inside the checkbox. */
40 | transform: rotate(-45deg);
41 | }
42 |
43 | input[type='checkbox']:focus + label::before {
44 | outline: #000000 solid 1px; /* Modify this to change the focus colour for the checkbox. */
45 | box-shadow: 0 0px 8px ;
46 | }
47 |
48 | input[type='checkbox'] {
49 | position: absolute !important;
50 | height: 1px;
51 | width: 1px;
52 | overflow: hidden;
53 | clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
54 | clip: rect(1px, 1px, 1px, 1px);
55 | }
56 |
--------------------------------------------------------------------------------
/floating-button-scroll.md:
--------------------------------------------------------------------------------
1 | # Floating button for mobiles to scroll to form
2 | This code will add a button fixed to the bottom of the page for screens less than 600 pixels wide that, when clicked,
3 | will scroll to specified content, such as the second column.
4 |
5 | This is useful if you are worried that the left column (which will sit above the right column in narrow screens is obscuring the fields that the supporter needs to complete.
6 |
7 | This code should all be within one code block. Note that you will need to have styled .button
8 |
9 | The button will scroll to the selector specified in $slideTo
10 |
11 | Example page: https://e-activist.com/page/29146/petition/1?mode=DEMO&locale=en-GB
12 |
13 | ```html
14 |
36 |
68 | ```
69 |
--------------------------------------------------------------------------------
/gift-aid-calculation.md:
--------------------------------------------------------------------------------
1 | You might want to tell the supporter how much their donation would be worth if they ticked the Gift Aid option. You can achieve this using calculated fields, but what if you want to show this within a text block, e.g. "With Gift Aid your donation would be worth £1.25"?
2 |
3 | One way is to add a code block with the following code:
4 |
5 | ```html
6 |
56 | ```
57 |
58 | And then inside the text block (with class "gift-aid") where you want to show the calculated amount, add this:
59 |
60 | ```html
61 |
Gift aid
62 |
With gift aid, every £1
63 | you give to us would be worth £1.25
64 | at no extra cost to you.
65 | ```
66 |
67 | The code will replace the values inside the text block with values based on the input donation amount. Bingo!
68 |
--------------------------------------------------------------------------------
/show-MP-name-on-data-capture.md:
--------------------------------------------------------------------------------
1 | This example uses the EaAOContactData public data service call.
2 |
3 | You can use data calls to query our contact databases for information and display them to the user, without having to use an email to target form.
4 |
5 | Here's an example using a postcode field on the first page of an action. When the supporter types this in and submits the page, the second page uses the postcode to request information from our MP contact database and then displays the supporter's MP in a copy block.
6 |
7 | 1) Create the first page of the data capture action, including the postcode field, email address and anything else you want.
8 |
9 | 2) On the second page, add a code block
10 |
11 | 3) In the Code Block, put in the following, updating 'your-token' with your public token
12 |
13 | ``` html
14 | {user_data~Postcode}
15 |
Your MP is
16 |
17 |
41 | ```
42 |
43 | 5) The page will then display something like: Your MP is Caroline Lucas MP
44 |
45 | # How does it work?
46 | The first span just puts the supporter's postcode in a hidden box so we can reference it later. The next paragraph then shows text to the supporter "Your MP is xxx", where xxx is filled in by the script.
47 |
48 | The script begins by assigning the postcode to a variable, which it gets from the hidden span. The dataurl that will be used to query the contact database is then made, including a filter for the supporter's postcode. The database ID refers to the Westminster MP database, and the service as seen on Public Data Services. The token is the public token you have on your account.
49 |
50 | The data request is then made, using the URL. When it is done, the received JSON information is put in a variable called data. From this, the MP's name is assembled via a few columns of the received data. Finally, it is inserted into the mpName span from the second line.
51 |
--------------------------------------------------------------------------------
/read-more-expand.md:
--------------------------------------------------------------------------------
1 | # Adding a read more expanding text block
2 |
3 | If you want some text that is hidden until a link is clicked, then you can do it by following these instructions
4 |
5 | First of all your template will need some javascript to add the functionality. Paste this into the bottom of your footer, just before the `