FormBuilder Recaptcha ignored in CiviCase Form
Overview
When creating a Afform CiviCase form volunteer form it seems to ignore whether the actual Recaptcha is completed. There is an error being thrown in the logs, but the form continues and is redrected to the Post-Submit page.
- Create a Form with Individual and Case
- Add Custom Fields associated to Individual and set Autofill on Current User
- Set Case Type to
Volunteer Application
and StatusNew Request
- Set permissions on Case to
Open Access
andCreate
- Set permissions on Individual to
Open Access
andCreate and Update
- No deduping
Here's the actual Markup I have
<af-form ctrl="afform">
<af-entity data="{contact_type: 'Individual', source: 'Volunteer Application'}" type="Contact" name="Individual1" label="Individual 1" actions="{create: true, update: true}" security="FBAC" autofill="user" contact-dedupe="" />
<af-entity data="{contact_id: 'Individual1', case_type_id: '3', subject: 'Request Form - Volunteer Application', status_id: '4'}" actions="{create: true, update: false}" type="Case" name="Case1" label="Case 1" security="FBAC" />
<div class="af-markup">
<p>If you don't have the necessary documents or would like to know more about any of our policies or processes, please contact the office.</p>
</div>
<fieldset af-fieldset="Individual1" class="af-container" af-title="Your details">
<div class="af-container af-layout-cols">
<af-field name="first_name" defn="{required: true, input_attrs: {}}" />
<af-field name="last_name" defn="{required: true, input_attrs: {}}" />
</div>
<fieldset af-join="Email">
<div class="af-container af-layout-cols">
<af-field name="email" />
<af-field name="location_type_id" />
<af-field name="is_primary" defn="{afform_default: '1'}" />
</div>
</fieldset>
<div af-join="Phone" af-repeat="Add" min="2" max="2">
<fieldset class="af-container af-layout-inline">
<af-field name="phone" defn="{required: false, input_attrs: {}}" />
<af-field name="location_type_id" defn="{required: false, input_attrs: {}}" />
<af-field name="phone_type_id" />
</fieldset>
</div>
<div af-join="Address">
<div class="af-container">
<af-field name="street_address" />
</div>
<div class="af-container af-layout-cols">
<af-field name="city" />
<af-field name="state_province_id" />
<af-field name="country_id" />
<af-field name="postal_code" />
<af-field name="location_type_id" defn="{label: 'Address Location', input_attrs: {}, required: false}" />
</div>
</div>
<div class="af-container af-layout-cols" af-title="Your interests and skills">
<af-field name="Volunteer_Details.Interests" defn="{label: 'Interests', required: true}" />
<af-field name="Volunteer_Details.Your_Skills" defn="{label: 'Abilities / Skills / Experience', required: true}" />
</div>
<div id="check" class="af-container" af-title="Police Information Check (PIC) is required for this position">
<div class="af-markup">
<p>markup</p>
</div>
<af-field name="Volunteer_Details.Police_Check" defn="{label: false}" />
</div>
<div id="driver" class="af-container af-layout-cols" af-title="Additional Required Information">
<af-field name="Volunteer_Details.Driver_s_License" defn="{label: 'Your Driver\'s License'}" />
<af-field name="Volunteer_Details.Driver_Insurance" defn="{label: 'Your Car Insurance'}" />
</div>
<div class="af-container" af-title="Availability">
<af-field name="Availability.Days_of_Week" defn="{required: true, label: 'Available Days of Week'}" />
<div class="af-container">
<af-field name="Availability.Location_willing_to_volunteer" defn="{required: true, label: 'What location are you willing to volunteer at?'}" />
<af-field name="Availability.Choose_a_depot" defn="{input_attrs: {autoOpen: true}, label: 'Choose a depot that you are hoping to volunteer at', required: true, saved_search: 'All_Depots', security: 'FBAC'}" />
</div>
<div id="outreach" af-join="Custom_Outreach">
<af-field name="How_did_you_hear_about_us_" defn="{label: 'How did you hear about us?', help_pre: 'Let us know how you heard about us.', help_post: null}" />
</div>
<div class="af-container" af-title="Privacy of our Members">
<af-field name="Volunteer_Details.Consent_to_confidentiality_of_member_and_organizational_informat" defn="{label: 'Do you consent to maintaining the confidentiality of members and organizational information?', required: true}" />
</div>
</div>
</fieldset>
<fieldset af-fieldset="Case1" class="af-container">
<af-field name="details" defn="{label: 'Tell us a little bit about yourself'}" />
<crm-recaptcha2></crm-recaptcha2>
<button class="af-button btn btn-primary" crm-icon="fa-check" ng-click="afform.submit()">Send Application</button>
</fieldset>
</af-form>
I don't think that this is a related problem to configuration of AuthX
, but if you need a screenshot of the permissions I set I can do that too.
Current behaviour
The submission goes directly to the Post-Submit page, and no actual entry is made for CiviCase.
The logs produce
Apr 18 11:20:49 [debug] AJAX Error ({error_id}): failed with exception
Array
(
[error_id] => uJNn-04Ej-YDUq
[exception] => CRM_Core_Exception: "Validation Error"
#0 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/ext/afform/core/Civi/Api4/Action/Afform/AbstractProcessor.php(74): Civi\Api4\Action\Afform\Submit->processForm()
#1 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/Civi/Api4/Provider/ActionObjectProvider.php(72): Civi\Api4\Action\Afform\AbstractProcessor->_run()
#2 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(158): Civi\Api4\Provider\ActionObjectProvider->invoke()
#3 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/AbstractAction.php(250): Civi\API\Kernel->runRequest()
#4 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/api/api.php(85): Civi\Api4\Generic\AbstractAction->execute()
#5 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Api4/Page/AJAX.php(138): civicrm_api4()
#6 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Api4/Page/AJAX.php(79): CRM_Api4_Page_AJAX->execute()
#7 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(319): CRM_Api4_Page_AJAX->run()
#8 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem()
#9 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke()
#10 /var/aegir/platforms/wordpress/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke()
#11 /var/aegir/platforms/wordpress/wp-includes/class-wp-hook.php(308): CiviCRM_For_WordPress->invoke()
#12 /var/aegir/platforms/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#13 /var/aegir/platforms/wordpress/wp-includes/plugin.php(565): WP_Hook->do_action()
#14 /var/aegir/platforms/wordpress/wp-includes/class-wp.php(797): do_action_ref_array()
#15 /var/aegir/platforms/wordpress/wp-includes/functions.php(1334): WP->main()
#16 /var/aegir/platforms/wordpress/wp-blog-header.php(16): wp()
#17 /var/aegir/platforms/wordpress/index.php(17): require("/var/aegir/platforms/wordpress/wp-blog-header.php")
#18 {main}
)
Expected behaviour
The form would not allow me to passthrough and would display an error message.