Using the {if} statement with RSForm!Pro PDF plugin

In order to use the {if} statement within the RSForm!Pro generated PDF files, you'll have to use one of the following scripts. There are two cases for creating the PDF layout, both explained below.


  1. If you have configured the PDF file for the User Email:
  2. Head to backend > Components > RSForm!Pro > Manage Forms > edit your form > Properties > PHP PDF Pre-Processing Scripts > 'User Email Pre-processing PHP Script' area and add the following code:

    require_once(JPATH_ADMINISTRATOR.'/components/com_rsform/helpers/scripting.php');
    RSFormProScripting::compile($info->useremail_layout, $args['placeholders'], $args['values']);
    
  3. If you have configured the PDF file for the Admin Email:
  4. Head to backend > Components > RSForm!Pro > Manage Forms > edit your form > Properties > PHP PDF Pre-Processing Scripts > 'Admin Email Pre-processing PHP Script' area and add the following code:

    require_once(JPATH_ADMINISTRATOR.'/components/com_rsform/helpers/scripting.php');
    RSFormProScripting::compile($info->adminemail_layout, $args['placeholders'], $args['values']);
    
    Example:

    Now you can simply use a syntax similar to the following:{if {fieldname:value}} {fieldname:caption}:{fieldname:value} {/if}

    You can also compare two placeholder values using <, >, <= or >=
    {if {field_name:value}<{other_field:value}} this text will be displayed if {field_name:value} has a lower value {/if}


    16 persons found this article helpful.


    Was this article helpful?

    Yes No
    Sorry about that

    You Should Also Read

    PHP PDF Pre-Processing Scripts HOT

    PDF plugin - tips and tricks HOT

    Improving the PDF export for submissions HOT

    Save PDF file to folder