Customizing Forms

From FiFormsWiki

Jump to: navigation, search

Once you've created a new form using the Form Creator or from a template, you'll want to customize the form to do what you want it to do. This article describes the detailed structure of the XML forms, and how to customize them to do what you want them to do.


Contents

Input Types


Subforms

Parameters

Custom Queries

Query Debugging

As you create forms and reports, you will inevitably have the need to see what FiForms is doing to your queries "under the hood." Simply edit your localconfig.php file, and set

    $FIFORMS_CONFIG['QUERY_DEBUGGING'] = true;

Then you should see a popup appear in the forms, which will show every query that FiForms issues to your database server.

Form Searching

FiForms includes a feature to add a text search box to the top of any form. You can do this by including an empty <formSearch /> element in the form definition. However, this does NOT automatically enable searching--you as the developer must implement the actual search algorithm in the form query, using the newly available parameter %_FiFormSearch%. Here is a little example:

<fiform>
...
   <formSearch />
   <query>
     <sql>
       SELECT * FROM clients
       WHERE LastName = "%_FiFormSearch%"
       OR FirstName LIKE "%_FiFormSearch%%"
       OR "%_FiFormSearch%" = ""
     </sql>
   </query>
...
</fiform>

The above example will place the search box on the form, and the parameter will be substituted in the SQL Query as shown.

Conditional Definitions (the if element)

Customized Layout

Page Wrapper

The page wrapper in FiForms allows you to specify HTML to be included within the form, to customize the form's behavior. The wrapper contents can be specified using the <wrapper /> element, which should appear right at the end of the <fiform /> element. It can contain any or all of the headerTags, bodyProperties, pageHeader, and pageFooter elements. Following is an example that uses all of these elements. This places two (empty) javascript functions into the html header, and adds the necessary attributes to the body element to call them. It also places some HTML content before and after the form, using pageHeader and pageFooter.

...

<wrapper>
   <headerTags xmlns="http://www.w3.org/1999/xhtml">

     <script type="text/javascript">
       function do_my_load_function()
       {
           
       }

       function do_my_resize_function()
       {
           
       }
     </script>

   </headerTags>
   <bodyProperties onload="FiForm_onLoad();do_my_load_function();" onresize="do_my_resize_function();" />

   <pageHeader xmlns="http://www.w3.org/1999/xhtml">

     Hello, <span style="color: red;">WORLD!</span>

   </pageHeader>

   <pageFooter xmlns="http://www.w3.org/1999/xhtml">
 
    <h2>Goodbye, World</h2>

   </pageFooter>

</wrapper>

...

Note that the onload attribute of bodyProperties will replace the onload event already in FiForms, which calls the FiForm_onLoad() javascript function, so any custom javascript should also call this function, in order not to break normal functionality of FiForms.

Grouping Containers

XML Schema and Formal Documentation

The XML schemas for the entire http://xml.fiforms.org/FiForms/ namespace can be found at the namespace URL http://xml.fiforms.org/FiForms/


As of this writing, the FiForms Framework version 1.1 is the latest released version, with development version 1.2 available in CVS. Form definitions given in this page use schema version 1.1, although other documentation on this wiki is specifically for the new 1.2 upcoming release. We make an effort to insure that XML applications that conform to the schemas in released versions of FiForms will be forward compatible with future releases of FiForms, or at least that an automated process (such as XSLT stylesheets) will be available to convert legacy applications to future standards. However, as with any free software project, the software is distributed AS-IS, unless you would like to pay us for support. ;)

Continue building your application. No database application is complete without custom reports, and FiForms is no different. Continue through the tutorial by reading the Reports article.

Personal tools
This is a cached copy of the requested page, and may not be up to date.

Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.

(Can't contact the database server: The server requested authentication method unknown to the client (localhost))


You can try searching via Google in the meantime.
Note that their indexes of our content may be out of date.