A common scenario where a callback is needed is if you want to redirect to another form AND pass some values from the first form to pre-populate the second. One example would be if the user is taken to an additional form or process that could pre-populate with the submitter's information already entered in the first form. 


Below is discussion of the callback process.  This document has more detail about the process.  If you just need a simple example to implement -> Success Callback - Example


There are a few important things to keep in mind if you decide to use the callback option:

1. You need an understanding of Javascript/jQuery


2. Your callback functions should be created in a Javascript file within your theme, not from the plugin. If you edit a file in the plugin it will be overwritten when you update the plugin.


3. NEVER pass field values from fields that may contain PHI! While this plugin has been designed to keep your forms HIPAA compliant, use of the callback is one area where you could ultimately expose your form data and in turn violate HIPAA regulations. Passing identifier values through this method such as name, email, phone, address, etc. is fine as well as other non-health related values. Never pass any value that contains health information.


While simply passing PHI from one form to another through the URI while under SSL may not be a HIPAA violation, the fact that you're passing it to another insecure form means that data could ultimately end up being emailed or stored on your hosting server when that form is submitted which most likely would be a HIPAA violation.

It is your responsibility to ensure you're following HIPAA guidelines when using this option!

A basic example would look something like this...


From a js file in your theme:


function myFormCallback() {

var valueOne = jQuery('#fieldid1').val(); // GET FIELD1 VALUE FROM FORM

var valueTwo = jQuery('#fieldid2').val(); // GET FIELD2 VALUE FROM FORM

var valueThree = jQuery('#fieldid3').val(); // GET FIELD3 VALUE FROM FORM

// REDIRECT TO FORM PAGE WITH PARAMS

window.location.href('https://www.mysecondformpage.com?field1=' + valueOne + '&field2=' + valueTwo + '&field3=' + valueThree);

}

From the HIPAA Forms plugin form settings you would set the submit success handler as "success callback" and in the first field for function name put myFormCallback. In this example you're not passing any parameters to the function so you can just leave the second input empty.

If you wanted to make the function more ambiguous and reusable from different forms you could pass the field id's as params in that second input and then from your function add them like myFormCallback(fieldId1, fieldId2, etc) and then get your values dynamically from within the function like var valueOne = jQuery('#' + fieldId1).val();.


Attached is another example with the passing of a single field.  This is the same attachment used in Success Callback - Example