Skip to main content

Prevent multiple submissions on RSForms

Sometimes multiple submissions are created by site visitors clicking rthe submit button repeatedly.

We can stop that by disabling the submit button after the first click and changing the button text to 'Sending ...' 

This is currently implemeted on Biomin.

To fix:  Go to componenets > RSForm! Pro > Manage Forms > Choose the form > Form Properties > CSS and Javascript

Enter the following code in the Javascript area:

<script>
jQuery(document).ready(function($) {
    $('.rsform-submit-button').on('click', function() {
        $(this).prop('disabled', true).text('Sending...');
        $(this).closest('form').submit();
    });
});
</script>

 

 

  • Hits: 3

Send an Additional Email when a condition on a field is met

Useful for when you want to highlight something or answer a specific query being raised.

Use case here is for BioMin - they wanted an additional email to be sent when a poor revoiew rating was given.

Method:

1.  Create your additional email.

2.   Add some PHP to fire the Additional Email.  Form Properties > PHP Email Scripts > Script called bewfore an Additional Emails are sent - replace the 'fieldname' with the field you are using.

$fieldName = 'rating';

// Don't send an email if rating is higher than 2
if (isset($_POST['form'][$fieldName]) && $_POST['form'][$fieldName] > 2)
{
$additionalEmail['to'] = '';
}
  • Hits: 7

RSForm design style code

------------

/* RSForm design */

.col-sm-12 {
background-color: #ededed;
padding: 20px
}

.formContainer>.uk-grid>.uk-width-12-12 {
background-color: #ededed;
padding: 20px
}
  • Hits: 14

Hiding output that has no value in emails - pseudocode

In your emails that are sent to users and admins there is often a list of values that the form has generated.

You can hide the 'empty' values using psuedocode in the email output.

example:

Say you want to output the value of a field with Text.  

You want to show 'Lot No 347', where '347' is the value taken from the form.

For the first value in the list - lot01-value  - you will therefore use 

Lot No: {lot01-value}

If lot01-value is empty then the email will still 'Lot No:' in the output.

You can hide the 'Lot No:' word by using an {if} statement to hide the text if there is no value - as follows:

{if {lot01-value}}Lot No: {lot01-value} {/if}

Now 'Lot No: ' wil only show in the email if there is a value in the field.

  • Hits: 7