Gantry

 view release on metacpan or  search on metacpan

root/form.tt  view on Meta::CPAN

[%#

Shows a user input form, usually for adding a single row to a single table.

Parameters:

    self       - the site object (if self has a params hash values shown on
                 the form are taken from it)
    view.title - thr browser window title
    view.form  - a hash with these keys:
        method      - POST or GET (defaults to POST)
        action      - url of page to process form (defaults to self.uri)
        name        - the name of the form (useful for javascript references)
        row         - the current row object from the table (if available)
        javascript  - javascript code the form needs (like for date popups.
                      Consider using Gantry::Plugins::Calendar and calling
                      its calendar_month_js.
                      (This could actually be anything, it just gets copied to
                      the output immediately after the form opening tag)
        legend      - The title for the legend box wrapping the form.
        change_log  - An array of change_log entries (optional).  Each entry
                      is a hash with these keys:
                          date    - the date the change happened
                          by      - the name of the person making the change
                          message - what happened
        results     - the return value from Data::FormValidator->check
        cellspacing - becomes the cellspacing parameter of the form's table
                      (defaults to 0)
        width       - becomes the width parameter of the form's table

        fields      - an array of inputable items.  Each element is a has
                      with these keys:
                          raw_html - copied to the table before the row for
                                     the field
                          label    - text description displayed to user
                          content  - additional description text used only
                                     next to the input box, not in errors.
                          width    - width of the field's <td>
                          label_width - width of the field's label <td>
                          name     - the name of the field in the form
                                     (much match the database column name)
                          default_value - what shows up if there is no previous
                                          value and nothting is in the
                                          database
                          type     - One of:
                                         select (pick one drop down list)
                                         select_multiple (pick 1 or more)
                                         text
                                         textarea
                      the rest of the keys in the fields hash depend on the
                      type:
                          select
                              options - An array of hashes with these keys:
                                            value - the form's value for this
                                                    option
                                            label - what the user sees in the
                                                    list
                          select_multiple
                              options - just as for select
                              selected - a code reference which accepts one
                                         value, and the form params.  Return
                                         true if the value is selected, false
                                         otherwise.  Usually
                                         Gantry::Plugins::CRUD's
                                         select_multiple_closure works well.
                          text
                              date_select_text - the text of the href link for
                                                 the date popup window.
                                                 You must include this to
                                                 get a date popup link.
                              display_size     - the size attribute of the
                                                 input element
                              (this is called display_size because TT has
                              a pseudo-method .size which tells how many keys
                              are in the field's hash)
                          textarea
                              rows - how tall the area is



( run in 1.450 second using v1.01-cache-2.11-cpan-d8267643d1d )