name = $name; $this->data = $data; $this->render = $render; $this->committed = 0; $this->validated = 0; } function validate() { if ($this->validated || $this->aquired) { return; } $this->aquired=1; $this->data->aquire($_REQUEST[$this->name]); /* moved here to allow new forms to be populated auto */ if (!$_REQUEST[$this->name]) { return; } if ($this->data->validate() == 0) { $this->data->commit(); $this->committed = 1; } $this->validated=1; } /* * Only activates if data is there to be handled, does not * render form if commit is successful. */ function handle() { $this->validate(); if (!$this->committed) { $this->render->render($this->name, $this->data); } } /* * Renders form no matter what (even if empty) * Renders form subsequent to successful commit */ function render() { $this->validate(); $this->render->render($this->name, $this->data); } }; ?>