DotPlant2 documentation

Form

Create a form

In DotPlant CMS may create any form directly from the admin panel in Radel form.

Form has following manufacture field:

  • Name - The name of the form (required)
  • Presentation form - path to the presentation file
  • Presentation of successfully sent form - path to view file of the form is submitted successfully
  • Address for notification - a list of e-mail addresses for notification when a new form - sent separated
  • Presentation of e-mail alerts - path to the file submission e-mail notification (required)
  • Form Open Analytics Action ID - Analytics ID on the display of the user form
  • Form Submit Analytics Action ID - Analytics ID on the form is submitted

Form fields are set through the properties. Read more about this in the properties section.

Display form

Minimum call widget displaying the form as follows:

<?=
\app\widgets\form\Form::widget(
    [
        'formId' => 1,
    ]
)
?>

In addition there are a number of additional parameters:

  • id - the id (the default is generated by Yii);
  • isModal - (default false);
  • formId - ID form (required parameter);
  • route - Route to which to send the form data (default 'default/submit-form');
  • options - html-array of options (default ['data-type' => 'form-widget']).

An example of the form in a modal window

First, add the code in the page call form widget

<?=
\app\widgets\form\Form::widget(
    [
        'formId' => 1,
        'id' => 'callback',
        'isModal' => true,
    ]
)
?>

Then connect the modal window call to link (<a href="#" data-toggle="modal" data-target="#modal-form-callback">Show</a>) or button (<button data-toggle="modal" data-target="#modal-form-callback"></button>). Now when you click on these elements, we will open a modal window with a form.

Important! data-target formed as follows #modal-form- + ID form.

You can also call the modal window with jQuery jQuery('#modal-form-callback').modal('show');.