Class PHRUTS_ActionForm

Description

A PHRUTS_ActionForm is a PHPBean optionally associated with one or more PHRUTS_ActionConfig.

Such a bean will have had its properties initialized from the corresponding request parameters before the corresponding action's execute method is called.

When the properties of this bean have been populated, but before the execute method of the action is called, this bean's validate method will be called, which gives the bean a chance to verify that the properties submitted by the user are correct and valid. If this method finds problems, it returns an error messages object that encapsulates those problems, and the controller service will return control to the corresponding input form. Otherwise, the validate method returns null, indicating that everything is acceptable and the corresponding PHRUTS_Action's execute() method should be called.

This class must be subclassed in order to be instantiated. Subclasses should provide property getter and setter methods for all of the bean properties they wish to expose, plus override any of the public or protected methods for which they wish to provide modified functionality.

  • author: John WILDENAUER <jwilde@users.sourceforge.net> (PHP4 port of Struts)
  • author: Olivier HENRY <oliv.henry@gmail.com> (PHP5 port of Struts)
  • version: $Id: PHRUTS_ActionForm.php,v 1.2 2008/05/21 16:39:50 ohenry Exp $
  • copyright: Copyright PHruts 2008
  • todo: Manage setService() calls with or without null argument.
  • abstract:

Located in /action/PHRUTS_ActionForm.php (line 52)


	
			
Variable Summary
Method Summary
void reset ( $mapping,  $request)
void setService (PHRUTS_ActionService $service)
PHRUTS_ActionErrors validate ( $mapping,  $request)
Variables
PHRUTS_ActionService $service = null (line 58)

The controller service instance to which we are attached.

  • access: protected
Methods
getService (line 65)

Return the controller service instance to which we are attached.

  • access: public
PHRUTS_ActionService getService ()
reset (line 97)

Reset all bean properties to their default state.

This method is called before the properties are repopulated by the controller service.

The default implementation does nothing. Subclasses should override this method to reset all bean properties to default values.

This method is not the appropriate place to initialize form values for an "update" type page (this should be done in a setup PHRUTS_Action). You mainly need to worry about setting checkbox values to false; most of the time you can leave this method unimplemented.

  • access: public
void reset ( $mapping,  $request)
setService (line 76)

Set the controller service instance to which we are attached (if service is non-null), or release any allocated resources (if service is null).

  • todo: Check if the parameter is a PHRUTS_ActionService object.
  • access: public
void setService (PHRUTS_ActionService $service)
validate (line 119)

Validate the properties that have been set for this HTTP request, and return a PHRUTS_ActionErrors object that encapsulates any validation errors that have been found.

If no errors are found, return null or an PHRUTS_ActionErrors object with no recorded error messages.

The default implementation performs no validation and returns null. Subclasses must override this method to provide any validation they wish to perform.

  • access: public
PHRUTS_ActionErrors validate ( $mapping,  $request)

Documentation generated on Sat, 31 May 2008 17:04:46 +0200 by phpDocumentor 1.4.1