Dealing with large forms

susans 23 Oct, 2012
Do you have any suggestions as to how to deal with large forms?

We have several multi-page forms and any time we want to add an element to the form in wizard mode we end up having to drag it from the bottom to the appropriate place. With over 150 elements that is a tricky activity.

We would be comfortable to add elements directly in the code view. However, those elements tend to get lost if the form is then edited and saved in wizard mode (i.e. to add additional events and actions).

What is the recommended best practice for handling large form projects?
GreyHead 23 Oct, 2012
Hi susans,

There are a few things that you might explore.

a) You can break multi-page forms into separate forms each of more manageable size. You can then use the 'Session to Data' and 'Data to Session' actions to pass data between them.

b) You can use Container actions to group pages or sub-pages together. The Containers can conveniently be fieldsets or just plain empty, they allow you to collapse chunks of the form and so make the dragging and dropping easier.

c) You can try the Show Form action to include one form inside another. This looks very useful but I haven't so far tested it out.

d) You can, as you suggest, edit the Form HTML in the Form Code tab. You need to set the Form Type to Custom if you do this to allow you to continue to use the Wizard to manage the actions without over-writing the HTML.

e) Rather than the Form Code tab you can use the Custom Element element to include chunks of HTML either entered in the element Code box or included from external files. I find this a more flexible approach than d) above as it allows you to mix and match.

f) In an emergency I've found that you can move form elements around by editing the Form Wizard data in the database table. I don't recommend this but it can be a life-saver if you find that your form is damaged and the Form Wizard no longer allows you to edit elements. The Form Wizard database entry is an array of element arrays - with care you can edit and move the element arrays around. Note that you need to re-load the Form in the Wizard after editing and then re-save it to re-create the new Form HTML.

Bob
susans 23 Oct, 2012
Is there an easy way to move existing elements into a container? It does not seem like I can drag the elements into the container.
GreyHead 23 Oct, 2012
Hi susans,

No, there's no easy way to do that in the Form Wizard. You have to re-create the elements.

If you are comfortable with PHPMyAdmin or MySQL Workbench (which I use) then you can do this in the database. Make a copy of your form to experiment with. Find the #__chronoforms table in the database and find the record for your form. Open the wizardcode column for editing. Here's an extract:
array (
 . . .
 'field_2' => 
  array (
    'input_container_2_area_label' => 'Employer 1',
    'input_container_2_collapsed' => '0',
    'input_container_2_container_type' => 'fieldset',
    'input_container_2_container_class' => '',
    'input_container_2_start_code' => '',
    'input_container_2_end_code' => '',
    'tag' => 'input',
    'type' => 'container',
    'container_id' => '1',
  ),
  'field_3' => 
  array (
    'input_text_3_input_id' => '',
    'input_text_3_label_text' => 'Employer',
    'input_text_3_input_name' => 'employer_1',
    'input_text_3_input_value' => '',
    'input_text_3_input_maxlength' => '20',
    'input_text_3_input_size' => '30',
    'input_text_3_input_class' => '',
    'input_text_3_input_title' => '',
    'input_text_3_label_over' => '0',
    'input_text_3_hide_label' => '0',
    'input_text_3_multiline_start' => '0',
    'input_text_3_multiline_add' => '0',
    'input_text_3_validations' => '',
    'input_text_3_instructions' => '',
    'input_text_3_tooltip' => '',
    'tag' => 'input',
    'type' => 'text',
    'container_id' => '2',
  ),
 . . .
)

You can see that field_2 has the type 'container' and Field_3 has a matching container_id. You can put a field inside a container by adding the container_id.

Bob
This topic is locked and no more replies can be posted.