We make it simple, you succeed!

Custom CSS

Enter custom CSS code to style the form according to your preferences. The class jl-form-{id} is the root class of the form, where {id} should be replaced with the form ID. For eg:

.jl-form-1 label { font-weight: bold }...

Custom JS

Enter custom JavaScript code to add effects or custom behaviors to the form. For eg:

const container = document.querySelector('.jl-form-{id}');...

Custom PHP

The PHP code provides three functions: onJLFormBeforeShow, onJLFormBeforeSubmit and onJLFormAfterSubmit

  • onJLFormBeforeShow: This function is executed before the form is shown.

    Parameters: Joomlab\Component\JLForm\Site\Event\BeforeShowEvent $event

    • Argument $event->getForm(): An object containing form information.
    • Argument $event->getBuildSteps(): An array of the built steps buffer.
  • onJLFormBeforeSubmit: This function is executed before the data is saved to the database.

    Parameters: Joomlab\Component\JLForm\Site\Event\BeforeSubmitEvent $event

    • Param $event->getForm(): An object containing form information.
    • Param $event->getValidData(): An array of user-submitted values.
  • onJLFormAfterSubmit: This function is executed after the data is saved to the database.

    Parameters: Joomlab\Component\JLForm\Site\Event\AfterSubmitEvent $event

    • Param $event->getForm(): An object containing form information.
    • Param $event->getSubmission(): A Joomla Table object containing submission data.

For eg: (see more at the sample: "Users login/register form")

<?php
defined('_JEXEC') or die;

use Joomlab\Component\JLForm\Site\Event\BeforeShowEvent;
use Joomlab\Component\JLForm\Site\Event\BeforeSubmitEvent;
use Joomlab\Component\JLForm\Site\Event\AfterSubmitEvent;

function onJLFormBeforeSubmit(BeforeShowEvent $event) {
  $event->addResult('The custom form string/HTML buffer will replace the form HTML output (see the sample "Users form")');
}

function onJLFormBeforeSubmit(BeforeSubmitEvent $event) {
  dd($event->getForm(), $event->getValidData());
}
            
function onJLFormAfterSubmit(AfterSubmitEvent $event) {
  dd($event->getForm(), $event->getSubmission());
}

Notes: Ensure your PHP code is accurate and syntactically correct; otherwise, it will not be saved. If your code is relatively complex, consider creating a plugin with the group jlform and defining the corresponding methods as shown above. The plugin methods will be executed before the custom functions.