GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  JIFTY::PARAM::SCHEMA (3)

.ds Aq ’

NAME

Jifty::Param::Schema - Declare parameters of a Jifty action with ease.

CONTENTS

SYNOPSIS



    package MyApp::Action::Login;
    use Jifty::Param::Schema;
    use Jifty::Action schema {

    param email =>
        label is Email address,
        is mandatory,
        ajax validates;

    param password =>
        type is password,
        label is Password,
        is mandatory;

    param remember =>
        type is checkbox,
        label is Remember me?,
        hints is If you want, your browser can remember your login for you,
        default is 0;

    };



DESCRIPTION

This module provides a simple syntax to declare action parameters.

It re-exports defer and lazy from Scalar::Defer, for setting parameter fields that must be recomputed at request-time:



    param name =>
        default is defer { Jifty->web->current_user->name };



See Scalar::Defer for more information about defer.

    schema

The schema block from a Jifty::Action subclass describes an action for a Jifty application.

Within the schema block, the localization function _ is redefined with defer, so that it resolves into a dynamic value that will be recalculated upon each request, according to the user’s current language preference.

    param

Each param statement inside the schema block sets out the name and attributes used to describe one named parameter, which is then used to build a Jifty::Param object. That class defines possible field names to use in the declarative syntax here.

The param function is not available outside the schema block.

ALIASES

In addition to the labels provided by Jifty::Web::Form::Field and Jifty::Param, this module offers the following aliases:



    ajax validates,             # ajax_validates is 1
    ajax canonicalizes,         # ajax_canonicalizes is 1
    order is -1,                # sort_order is -1
    default is 0,               # default_value is 0
    valid are qw( 1 2 3 ),      # valid_values are qw( 1 2 3 )
    available are qw( 1 2 3 ),  # available_values are qw( 1 2 3 )
    render as select,         # render_as is select



SEE ALSO

Object::Declare, Scalar::Defer

    merge_params HASHREF HASHREF

Takes two hashrefs. Merges them together and returns the merged hashref.



    - Empty fields in subclasses dont override nonempty fields in superclass anymore.
    - Arrays dont merge; e.g. if parent classs valid_values is [1,2,3,4], and
      subclasss valid_values() is [1,2], they dont somehow become [1,2,3,4,1,2].



BUG: This should either be a private routine or factored out into Jifty::Util

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 JIFTY::PARAM::SCHEMA (3) 2010-09-25

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.