MT::App::CMS::cms_save_filter.$type

This callback is invoked just prior to saving an object and is typically used for validating form input submitted by the user. The callback can be targeted to a specific data type by modifying the value of $type with one of the registered MT::Objects or data types.

Input Parameters

  • $cb - a reference to the current MT::Callback object handling this event.
  • $app - a handle to the current MT::App::CMS object processing this request.

Return Value

None.

Example Handler

sub handler {
    my ($cb, $app) = @_;
    if ($app->param('some_form_input') !~ /^\d+$/) {
        return $cb->error("The field 'some form input' must be a numeric value.");
    }
}
This page was last updated on 2008-10-01, 17:03.

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.