Form Builder

Setting minimum amount in forms

Senest redigeret:

Would you like to set minimum amounts in your OnlineFundraising forms? Follow these simple steps, which also explain how to create an error message if a donor enters an amount below the minimum.

Step 1: Locate your form 

If you want to set a minimum amount on an existing form, first locate the form you wish to edit. If you're already on the editing page, you can skip this step.

Select Form Builder from the OnlineFundraisings main menu. Here, you will find a list of your existing forms. Click on the name of the form you want to edit.  

formbuilder.png

Step 2: Edit the amount field

Under Fields, you'll find the amount field.

Sk_rmbillede_2021-08-17_kl._12.36.08.png
Set the Input type field to Radio (please add values).

In the Options field, you can write suggested amounts separated by commas. If you want to allow donors to enter an optional amount, specify it with "#". This is also where you set y our minimum amount by typing: ">" followed by the desired minimum amount. For example, if you want to set a minimum amount of 5 EUR, write ">50". 

Step 3: Customising the error message 

When a donor tries to enter an amount less than the specified minimum, an error message will automatically appear.

You can customise this text by inserting a short HTML script. This script can include both the entered amount and the specified minimum amount. 

Scroll down to the section: Customise styling, HTML in head, and javascript, and click on it to expand the menu.Sk_rmbillede_2021-08-16_kl._14.15.56.png

Here, you'll find a text field titled Apply javascript with jQuery support to this particular form. This is where you'll insert the script to change the error message.

Sk_rmbillede_2021-08-17_kl._12.39.04.png

Code

You can use the script below to display: [Entered amount] is unfortunately too small. We need [minimum amount]. 

You can also change the wording by editing the script.

function client_refresh_form(init) {

var result = window.getFormVars();

// If amountPseudo-field exists, amount is 0, amountPseudo is not empty and lower than a minimum amount
if ( $('input[name="amountPseudo"]').length && result.amount === '0' && result.amountPseudo !== '' && result.amountPseudo < parseInt( $('input[name="amountPseudo"]').attr('min') ) ) {
$('input[name="amountPseudo"]').attr( 'title', result.amountPseudo +' is unfortunately too small. We need '+ $('input[name="amountPseudo"]').attr('min') + ' kr.' );
}
}

// Initial form check
client_refresh_form(true);

// Check form on every change
$(document).on('formChange', function (elem) {
client_refresh_form(false);
});

If you need assistance, feel free to contact us at: support@onlinefundraising.dk