Quick links: Content - sections - sub sections
EN FR
The page corresponding to the latest stable release can be seen in the Jelix 1.8 Manual

As noted in display jforms chapter, you can select which plugin will generate forms content (in HTML, XUL, javascript and so on..) sent to clients.

Thoses plugins are called generators. You can of course create one and for any format. Pick a name, say "moreforms". Then :

  • Create a moreforms directory in a jforms plugins repository.
  • Create a moreforms.jformsbuilder.php
  • In it, declare a moreformsJformsBuilder class inheriting from jFormsBuilderBase

moreformsJformsBuilder should implement following list of methods. Those display form parts and don't return any value. They are called through jForms template plugins.

After each modification of your generator, don't forget to clear your temp directory (by using the command cleartemp for example).

outputMetaContent

Use the controller response object to specify CSS stylesheets, javascript files to be included in the final response. Example :


   public function outputMetaContent($t) {

        $resp = jApp::coord()->response;
        if ($resp === null) {
            return;
        }
        // if files are located in jelix folder
        $www = jApp::config()->urlengine['jelixWWWPath'];
        // or in your app www folder        
        $www = jApp::config()->urlengine['basePath'];

        $resp->addJSLink($www.'js/file.js');
        $resp->addCSSLink($www.'design/file.css');
   }

This method is the first called.

outputHeader

This one generates tags declaring your form and other useful form contents. OutputHeader opens a <form> tag, optionally displays error messages, generates hidden fields and adds some javascript.

outputFooter

This is the last method called by template plugins. As for HTML, outputFooter closes the form tags </form> and adds some javascript.

outputAllControls()

This one is called by formfull template plugin. It has to generate all controls (apart of those generated by outputHeader and outputFooter).

outputControlLabel

Called in {form} template block for fields labels, it generates labels tags.

As argument, it receives a jFormsControl object defining the control associated.

outputControl

Called in {form} template block for controls, it generates control tags.

As argument, it receives a jFormsControl object defining the control associated.