form layout customization

There's nothing you couldn't do with Clonefish regarding form layout. There are several levels you can customize the appearance of your form:

Level 1: CSS formatting

Clonefish generates XHTML forms also equipped with semantic tags to support usability (like the <legend> tag or the <fieldset> element). You can use CSS to style these default tags.


Level 2: customizing defaults

The class has two default layouts: tabular and rowbyrow. A layout is a collection of HTML snippets in an array, stored in the layouts attribute of the class. Clonefish uses these snippets to create the HTML of the form elements. It's quite easy and efficient.

Level 3: element customization

Defaults are nice most of the time, but there are always exceptions. To override the layout container settings for a specific element you can use the rowlayout setting. This setting includes the label, the input element itself and all the bells and whistles (like error message placeholders, prefix/postfix strings and so on).

Though Clonefish tries to save you from hand-coding forms in HTML, you can still inject anything into the HTML code of the elements using the html setting, for example:

  $config = Array(
    'name' => Array(
     'displayname' => 'Your name:',
     'type'        => 'inputText',
     'html'        => ' class="wideinput" ',

Level 3: item customization

Radio button groups and similar elements have repeating structure (a radio button, a label, another button, another label) . These element types have their own item layout settings with which you can alter their appearance. An example:


  $config = Array(
    'genre' => Array(
      'displayname' => 'Genre:',
      'type'        => 'inputRadio',
      'values'      => Array( 'f' => 'female', 'm' => 'male' ),
      'itemlayout'  => '%radio% %label%<br  />',


Level 4: built-in templating

Sometimes you may need to arrange the fields in a special layout, think of grouping several text fields together for a name. In these cases a simple built-in templating element helps you.

affiliate program!

Do you run a PHP blog or related website? Join as an affiliate and earn money!
know more

form validation for developers!

clonefish is a proven, mature form generator class that helps PHP developers to create, validate and process secure, flexible and easy-to-maintain forms
learn more
Bookmark and Share