Skip to content
  1. Extras
  2. AjaxFormItLogin
  3. Snippets
  4. AjaxFormitLogin

AjaxFormitLogin

Snippet for outputting the form.

Parameters

ParameterDefaultDescription
formaflExampleFormForm chunk
snippetFormItSnippet that will process the form
hooksFormItSaveForm,emailHooks used to process the form.
emailToRecipient email
emailFromSender email. When using SMTP, specify the SMTP user email.
emailSubjectEmail subject.
emailTplaflExampleEmailEmail chunk.
successMessageForm submitted successfully! A manager will contact you within 5 minutes.Success notification message.
clearFieldsOnSuccess1Whether JS should clear fields after form submission.
transmittedParams["success" => "", "error" => "aliases"]List of parameters to pass to JS.
aliasesemail==EmailList of field aliases for displaying validation error messages.
validateemail:required:emailList of fields and their validators.
showUploadProgress1Whether JS should show file upload progress.
spamProtection1Enables built-in spam protection.
redirectTimeout2000Delay before redirect in milliseconds.
redirectToRedirect page ID or URL.
autoLoginWhether to log the user in automatically after account registration.
passwordFieldpasswordName of the field containing the password.
usernameFieldusernameName of the field containing the username.
activationWhether activation is required; if yes, an email with an activation link will be sent to the user.
moderateWhether moderation is required. If yes, the user profile will be blocked until a moderator unblocks it.
activationResourceIdID of the resource to which the user will be sent to activate the account.
usergroupsFieldField with a comma-separated list of groups to add the user to on registration. You can also specify access level (Member or SuperUser) and rank: group_id:permission_id:rank, e.g. 2:1:0. You may specify only the first two parameters or just the group ID.
authenticateContextsField with a comma-separated list of contexts in which to authenticate the user.
remembermeWhether to remember the user.
activationUrlTime10800Activation link validity time in seconds.
methodAjaxIdentification class method (register, login, logout, forgot, update).

Подсказка

You can also use any FormIt snippet parameters.

As shown in the table, the snippet is configured by default for form submission and saving data in the manager.

Usage example

A minimal call should look like this:

fenom
{'!AjaxFormitLogin' | snippet: [
  'emailTo' => 'name@domain.ru',
  'emailFrom' => 'noreply@domain.ru',
  'emailSubject' => 'Email subject',
]}

and must be called uncached. You can pass any data into the form chunk by specifying it as snippet parameters. You can also pass data to JS via the transmittedParams parameter. An optimal call looks like this:

fenom
{'!AjaxFormitLogin' | snippet: [
  'form' =>  'aflExampleForm',
  'snippet' => 'FormIt',
  'hooks' => 'FormItSaveForm,email',
  'emailTo' => 'shev.art.v@yandex.ru',
  'emailFrom' => 'noreply@art-sites.ru',
  'emailSubject' => 'Test form',
  'emailTpl' => 'aflExampleEmail',
  'successMessage' => 'Form submitted successfully! A manager will contact you within 5 minutes.',
  'clearFieldsOnSuccess' => 1,
  'transmittedParams' => ["success" => 'ym_goal', "error" => 'aliases'],
  'aliases' => 'email==Email,phone==Phone,name==Name,politics==Terms of service',
  'showUploadProgress' => 1,
  'spamProtection' => 1,
  'ym_goal' => 'TEST_GOAL',

  'validate' => 'email:required:email,name:required:minLength=^3^,phone:required,politics:minValue=^1^',
  'validationErrorMessage' => 'Please fix the errors!',
  'email.vTextRequired' => 'Specify email.',
  'fullname.vTextRequired' => 'Specify full name.',
  'fullname.vTextMinLength' => 'Full name is too short.',
  'secret.vTextContains' => 'You appear to be a bot. If not, please refresh the page.',
  'politics.vTextMinValue' => 'Please accept our terms.',
]}