pnForm
[ class tree: pnForm ] [ index: pnForm ] [ all elements ]

Class: pnFormVolatile

Source Location: /system/pnForm/plugins/block.pnformvolatile.php

Class Overview

pnFormPlugin
   |
   --pnFormVolatile

Volatile block container


Variables

Methods


Inherited Variables

Inherited Methods

Class: pnFormPlugin

pnFormPlugin::pnFormPlugin()
Constructor
pnFormPlugin::create()
Create event handler
pnFormPlugin::dataBound()
DataBound event handler
pnFormPlugin::decode()
Decode event handler
pnFormPlugin::decodePostBackEvent()
Decode event handler for actions that generate a postback event
pnFormPlugin::getIdHtml()
Utility function to generate HTML for ID attribute
pnFormPlugin::initialize()
Initialize event handler
pnFormPlugin::load()
Load event handler
pnFormPlugin::postRender()
PostRender event handler
pnFormPlugin::readParameters()
Read Smarty plugin parameters
pnFormPlugin::registerPlugin()
pnFormPlugin::render()
Render event handler
pnFormPlugin::renderAttributes()
pnFormPlugin::renderBegin()
RenderBegin event handler
pnFormPlugin::renderContent()
RenderContent event handler
pnFormPlugin::renderEnd()
RenderEnd event handler

Class Details

[line 52]
Volatile block container

This block is a hack, a not so elegant solution, to situations where you need to put pnForms plugins inside conditional smarty tags like if-then-else and foreach. You can get into problems if you make templates like this:

  1.   <!--[foreach from=... item=...]-->
  2.     <!--[pnformtextinput ...]-->
  3.     <!--[pnformbutton ...]-->
  4.   <!--[/foreach]-->
This is because the number of plugins on the page may change from one page to another due to changing conditions or amount of items in the foreach loop: on the first page you might have 5 iterations, whereas on postback you suddenly have 6. What should then be done to the missing (or excess) persisted plugin data on postback? The answer is: pnForms cannot handle this - your code will break!

So you need to tell pnForms that the block inside the foreach tags is volatile - pnForms should not try to save the state of the plugins inside the foreach loop. This is done with the volatile block:

  1.   <!--[pnformvolatile]-->
  2.   <!--[foreach from=... item=...]-->
  3.     <!--[pnformtextinput ...]-->
  4.     <!--[pnformbutton ...]-->
  5.   <!--[/foreach]-->
  6.   <!--[/pnformvolatile]-->
This disables the ability to persist data in the pnForms plugins, but does save you from trouble in some situations.

You don't need the volatile block if you can guarantee that the number of elements will be the same always.




[ Top ]


Class Variables

$volatile =  1

[line 54]


Type:   mixed
Overrides:   Array


[ Top ]



Class Methods


method create [line 62]

void create( &$render, &$params)



Overrides pnFormPlugin::create() (Create event handler)

Parameters:

   &$render  
   &$params  

[ Top ]

method getFilename [line 56]

void getFilename( )



[ Top ]


Documentation generated on Fri, 18 Jul 2008 21:43:12 +0200 by phpDocumentor 1.4.1