single fieldset with legend and submit button outside fieldset element with legend and optional submit button

fieldset

This is a special element type to create a fieldset.

If you use a fieldset element in your form with the submit setting set to 1, the fieldset will contain the submit button (which looks much better). You can use as many fieldsets as you like, and you can use even multiple submit buttons in several fieldsets (useful if fields are not required in every fieldsets).

As this element only affects form layout there's no returned element value  by $clonefish->getElementValues() or other getter methods.

Sometimes styling fieldsets can be very tricky, as several browsers (mostly the IE family) do not support detailed styling for <fieldset> and/or <legend>. In such cases you can still use the layout and legendtag settings to replace even the entire fieldset logic to DIVs and H1s for example. This way you can keep the very same comfortable behaviour of form generation and visual impression while you don't have to bother about styling tricks.

You can also attach anything above/below the contents of a fieldset using prefix and postfix.


<?php

$config 
= Array(

  
'fieldset' => Array(

    
'type'   => 'fieldset',

    
'layout=> '
       <fieldset %html% id="%id%">
          <%legendtag%>%legend%</%legendtag%>
          %prefix%
             %content%
          %postfix%
       </fieldset>'
,
    
'legendtag' => 'legend',

    
// this is the default layout of a fieldset.
    //
    // the %...% placeholders are used to build the entire fieldset.
    // the '%prefix%', '%postfix%', '%html%' placeholders are the generally 
    // used element parameters, while %legend% is only available
    // for fieldsets.

    
'legend' => 'Personal information',
    
'submit' => '1 | 0'// default: 0
    
'value'  => false,
    
// use a number here to define number of elements to include
    // in the fieldset. If you omit this value, all elements after
    // fieldset will be included until the next fieldset or until the
    // last element.

    
'html'           => 'class="inputfieldstyle"',
    
'prefix'         => 'string to display before element',
    
'postfix'        => 'string to display after element',
    
'display'        => 0,
    
'htmlid'         => 'name1',

  )

);

?>


Live examples:

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