'permission' => 'administer CiviCRM',
'url' => 'civicrm/admin/afform',
'is_active' => 1,
- 'icon' => 'crm-i fa-list-alt'
+ 'icon' => 'crm-i fa-list-alt',
]);
}
}
* @return TRUE on success
* @throws Exception
*/
- public function upgrade_0001() {
- $this->ctx->log->info('Applying update 0001');
- \Civi\Api4\Navigation::update(FALSE)
- ->addValue('icon', 'crm-i fa-list-alt')
- ->addValue('label', E::ts('Form Builder'))
- ->addValue('name', 'afform_admin')
- ->addWhere('name', '=', 'afform_gui')
- ->execute();
- return TRUE;
- }
+ public function upgrade_0001() {
+ $this->ctx->log->info('Applying update 0001');
+ \Civi\Api4\Navigation::update(FALSE)
+ ->addValue('icon', 'crm-i fa-list-alt')
+ ->addValue('label', E::ts('Form Builder'))
+ ->addValue('name', 'afform_admin')
+ ->addWhere('name', '=', 'afform_gui')
+ ->execute();
+ return TRUE;
+ }
}
};
$scope.save = function() {
+ var afform = JSON.parse(angular.toJson($scope.afform));
+ // This might be set to undefined by validation
+ afform.server_route = afform.server_route || '';
$scope.saving = $scope.changesSaved = true;
- crmApi4('Afform', 'save', {formatWhitespace: true, records: [JSON.parse(angular.toJson($scope.afform))]})
+ crmApi4('Afform', 'save', {formatWhitespace: true, records: [afform]})
.then(function (data) {
$scope.saving = false;
$scope.afform.name = data[0].name;
<label for="af_config_form_title">
{{:: ts('Title:') }} <span class="crm-marker">*</span>
</label>
- <input ng-model="afform.title" class="form-control" id="af_config_form_title" required />
+ <input ng-model="afform.title" class="form-control" id="af_config_form_title" required title="{{:: ts('Required') }}" />
</div>
<div class="form-group">
<div class="form-group">
<label for="af_config_form_server_route">
- {{:: ts('Path:') }}
+ {{:: ts('Page:') }}
</label>
- <input ng-model="afform.server_route" class="form-control" id="af_config_form_server_route" />
- <p class="help-block">{{:: ts('Expose the form as a standalone page on the web site. (Example: "civicrm/my-form")') }}</p>
+ <input ng-model="afform.server_route" class="form-control" id="af_config_form_server_route" pattern="^civicrm\/[-0-9a-zA-z\/_]+$" onfocus="this.value = this.value || 'civicrm/'" onblur="if (this.value === 'civicrm/') this.value = ''" title="{{:: ts('Path must begin with "civicrm/"') }}">
+ <p class="help-block">{{:: ts('Expose the form as a standalone webpage. (Must begin with "civicrm/" e.g. "civicrm/my-form")') }}</p>
</div>
<div class="form-group" ng-if="!!afform.server_route">