@@ -16,12 +16,12 @@ In this chapter we will briefly discuss the forms and screens you need to go thr
Once you installed the **Form Processor** extension you will have an additional option in the **Administer>Automation>Form processors** option which will lead you the the first view of all the form processors in your installation.
This will be empty if you just installed the extension.


## New Form Processor - define form processor
On this page you can click on the **New Form Processor** button to create a new form processor. If you do this you will see a form like the one below:


On the top of the form you can see that there are **two** tabs:
...
...
@@ -47,7 +47,7 @@ In the top part of the form you can enter the general form processor information
It will look something like this:


### Input fields on your form processor
...
...
@@ -57,11 +57,11 @@ For each field you can select the type of field (short text, numeric no decimal,
Adding the input field for the *email* will probably have to look like this:


Once I have added all the fields (and as you can see I have added the validation that first and last name should at least have 3 characters) the list will look like this:


What I have done now is specify that I expect my form to show 3 fields for the website visitor to enter: First Name, Last Name and Email.
...
...
@@ -73,7 +73,7 @@ We do that by adding *actions* to the form processor.
So in our example, we should find a contact by the email. Next the contact found should be added to the newsletter group.
Initially the part of the form where we can specify actions will look like this:


If you click on the action select box you will get a list of actions that are already available because some of the funding organizations needed that action.
As time goes by and more people start using and enhancing the [**Action Provider** extension][actionproviderrepo], the list will grow.
...
...
@@ -83,12 +83,12 @@ As time goes by and more people start using and enhancing the [**Action Provider
In this example we have a first step: find the contact with the data from the form.
Once I have found the contact it should be added to the newsletter group.
If I select the *add to group* action I can select the group and specify that I want to use the contact ID found in the previous action:


## New Form Processor - retrieval of defaults
...
...
@@ -97,7 +97,7 @@ We could pass a parameter (a checksum for example) in the URL of the form and ba
This can be specified in the *Retrieval of defaults* tab. Once I have ticked the *Enable default data retrieval?* option I will see a form like this:


As you can see the input fields from my form processor have already been loaded.
I can specify here what criteria I want to use, in this example I have specified a short text named *checksum*.
...
...
@@ -115,7 +115,7 @@ For each of my input fields I can finally specify what data should be loaded her
At the bottom of the form where you edit or create your form processor there is also a bit about an *output handler*:


This gives you the option to manipulate the output that is sent back to the public website once all the actions have been executed.
If you do not specify anything, the default value of *send everything* then all the data involved is sent back (inputs, output from actions etc.).
...
...
@@ -127,7 +127,7 @@ If you click on the *Retrieval of defaults* tab in the **New Form Processor** fo
And that is all! A form to be used without coding. Once I saved the form processor I can see at the top of the form what API action I can use:


So far the basic concept. Obviously the public website part needs to be done too, check the [Example Sign Up Newsletter](./sign-up-newsletter.md) section for that part, this section just covers the basis principles.
@@ -22,7 +22,7 @@ I would like to have a form on my website where a contact can specify his or her
The idea is that we include a link in each mailing or mail we send out with a checksum (see the wonderful [AGH Strategies Email Link Guide][aghchecksum]).
This link should lead to the form (prefilled if we know the person) which should look like this:


Once the person has ticked all their boxes the result should be processed into CiviCRM.
...
...
@@ -32,7 +32,7 @@ In CiviCRM I will have a few groups:
* a group called Monthy Actions
* a group called Yearly Summary


The email preferences should reflect this group membership:
...
...
@@ -65,7 +65,7 @@ This is not required, but it reflects the structure of CiviCRM and the structure
In the *Action* folder I can add my actions if I only expect to have a couple, or add a folder for each entity and then add my actions in there.
Because this extension for now will only hold 2 actions I will put them in the *Action* folder.
The action to find or create the contact has been specified so:


Finally in the action to add the contact to the group I have selected the group the contact should be added to and specified that the contact ID found in the find action should be used.


## Testing the form processor with the api explorer
...
...
@@ -41,7 +41,7 @@ The form processor generates an API action for the API entity FormProcessor so I
In this case this is what I will enter:


And if I then click on **Execute** it should actually add or find the contact and add him/her to the newsletter group.
...
...
@@ -53,11 +53,11 @@ I now need to design a form on my public website that communicates with my form
To be able to communicate with a CiviCRM installation on another server the **Contact Form 7 CiviCRM integration** plugin is installed, and I have also installed the **Contact Form 7** plugin. (see the [Requirements](./requirements.md) section):
The action to find or create the contact has been specified so:


So this action tries to find a contact with the email provided. If no contact with the email can be found, it uses the email and the first/last name to create a contact.
Finally in the action to add the contact to the group I have selected the group the contact should be added to and specified that the contact ID found in the find action should be used.


## Testing the form processor with the api explorer
...
...
@@ -43,7 +43,7 @@ The form processor generates an API action for the API entity FormProcessor so I
In this case this is what I will enter:


And if I then click on **Execute** it should actually add or find the contact and add him/her to the newsletter group.
...
...
@@ -55,11 +55,11 @@ I now need to design a form on my public website that communicates with my form
To be able to communicate with a CiviCRM installation on another server the **CMRF core** module is installed, and I have also enabled the **CRMF Webform** module and the **CMRF Form Processor** module (see the [Requirements](./requirements.md) section):
From this menu I can edit or add a CiviMRF profile. In this profile I specify if my connection with CiviCRM is remote (on another server) or local (the same server).
In this example it is remote, I have specified the URL to the REST interface of CiviCRM and added the site and API keys.
...
...
@@ -67,7 +67,7 @@ In this example it is remote, I have specified the URL to the REST interface of
!!! Note "Site and API keys"
(for background information check [System Administrator Guide on Site Key][sitekey] and [StackExchange on API key][apikey]).
Once I have done this I have configured how this profile connects to my CiviCRM installation.
...
...
@@ -79,40 +79,40 @@ Once I have done this I have configured how this profile connects to my CiviCRM
I am now going to create my form in Drupal by clicking *Add content*, then select *Webform* and finally add a name for my webform and hit the *Save* button.
Once I have done this I will see my new form like this:
To specify that I am going to use the CiviMRF profile with this form so it can communicate with the **Form Processor** I will now click on the **CiviMRF** tab and select *Submit to CiviCRM Form Processor*.
In the form I can select what *CiviMRF profile* I want to use and what *Form Processor* I want to use:


### Adding the fields on the form
Once I have hit *Save* I will go back to the *Form components* tab but I will now see a message warning me that I have not yet included fields from the Form Processor:
Next step is to add all the fields I want to be on my form. In my example I have only included the ones from my form processor but you could add whatever you want additionally, just remember this will not be sent to CiviCRM.