*/ $sections['Event'] = array( 'descr' => 'Events allow you to implement a ways of handling forms via callbacks instead of nested condition blocks. In short, you canget rid of any big switch/case and if/else blocks to process your forms.

You may register methods or functions that will be called if the form has been submitted, is valid or contains errors.

Event handlers are similar to plugins as they allow you to interact with the form while it is being processed.', 'basename' => 'example_event_', 'pages' => array( 'onsubmit' => array( 'title' => 'onSubmit', 'descr' => 'This example shows how to use the onSubmit handler to interact with your form once it has been submitted - in this case, to cancel the submission of the form altogether.', 'tabs' => array( 'hilights' => array( 'title' => 'Relevant parts', 'type' => 'guide', 'file' => '$exampleId.php', 'guide' => array( array( 'lines' => '50-53', 'text' => 'Flag that sets whether to cancel the event', ), array( 'lines' => '58-60', 'text' => 'Register the event handler', ), array( 'lines' => '62-83', 'text' => 'The event handling function', ), ), ), 'annotation' => array( 'title' => 'Notes', 'type' => 'text', 'text' => 'You will probably have noticed that the event is cancelled twice - this happens because of the autoValidation feature, which leads to a double check of the form\'s submitted state. It is not a bug, although we may implement a better tracking for this.', ), ), ), 'onsuccess' => array( 'title' => 'onSuccess', 'descr' => 'This example shows how to use the onSuccess handler to build a generic function that stores validated data.', 'tabs' => array( 'hilights' => array( 'title' => 'Relevant parts', 'type' => 'guide', 'file' => '$exampleId.php', 'guide' => array( array( 'lines' => '98-100', 'text' => 'Register the event handler', ), array( 'lines' => '102-122', 'text' => 'The event handling function', ), ), ), ), ), 'onerror' => array( 'title' => 'onError', 'descr' => 'This example shows how to use the onSuccess handler to build a generic function that displays error messages.', 'tabs' => array( 'hilights' => array( 'title' => 'Relevant parts', 'type' => 'guide', 'file' => '$exampleId.php', 'guide' => array( array( 'lines' => '53-55', 'text' => 'Register the event handler', ), array( 'lines' => '57-84', 'text' => 'The event handling function', ), ), ), ), ), 'combined' => array( 'title' => 'Combining several event handlers', 'descr' => 'This example shows you how to use several handlers in one script to automate form processing completely by using the autoValidate option.' ), 'object' => array( 'title' => 'Using an object as event handler', 'descr' => 'This example shows you how to register an object that provides method for all events. This makes event handling even easier, as you have all event handling methods in one place.', 'tabs' => array( 'hilights' => array( 'title' => 'Relevant parts', 'type' => 'guide', 'file' => '$exampleId.php', 'guide' => array( array( 'lines' => '53-106', 'text' => 'The event handling class', ), array( 'lines' => '108-109', 'text' => 'Instantiating the event handler object', ), array( 'lines' => '111-112', 'text' => 'Registering the event handler object', ), ), ), ), ), ) ); ?>