Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2008, 06:17 AM
Member
 
Join Date: Jun 2007
Posts: 33
Default Zend Form Issue

I'm getting an odd error when trying to use Zend_Form:
Fatal error: Class 'Zend_Form_Element_Text' not found in /home/tplgame/public_html/application/forms/RegisterForm.php on line 11

Here's my form itself, as you can see it's very basic and definitely shouldn't give this error.
PHP Code:
<?php
Zend_Loader
::loadClass('Zend_Form');

class 
RegisterForm extends Zend_Form
{
    public function 
__construct($options null)
    {
        
parent::__construct($options);
        
$this->setName('register');
        
        
$username = new Zend_Form_Element_Text('username');
        
$username->setLabel('Username')
            ->
setRequired(true)
            ->
setValidators('NotEmpty');
            
        
$username = new Zend_Form_Element_Text('email');
        
$username->setLabel('Email Address')
            ->
setRequired(true)
            ->
setValidators('NotEmpty');
            
        
$password = new Zend_Form_Element_Password('password');
        
$password->setLabel('Password')
            ->
setRequired(true)
            ->
setValidators('NotEmpty');
            
        
$confirm_password = new Zend_Form_Element_Password('confirm_password');
        
$confirm_password->setLabel('Confirm Password')
            ->
setRequired(true)
            ->
setValidators('NotEmpty');
            
        
$submit = new Zend_Form_Element_Submit('submit');
        
$submit->setLabel('Register');
        
        
$this->addElements(array($username$email$password$confirm_password$submit));
    }
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 12:40 PM
Junior Member
 
Join Date: Apr 2008
Posts: 7
Default

One assumes you have activated Auto loader otherwise you would need to include the source files.

I always use this form

PHP Code:
        $form = new Zend_Form();
        
$form->setAction('edit')
             ->
setMethod('post')
             ->
setAttrib('class''dtTable');
        
$back $form->createElement('hidden''back');
        
        
// Create and configure username element:
        
$username $form->createElement('text''username');
        
$username->addValidator('stringLength'false, array(520))
                 ->
setRequired(true)
                 ->
addFilter('StringToLower')
                 ->
setLabel('Username')
                  ->
addDecorator(new Form_Decorator_Label)
                 ->
setOrder(1); 
long winded but easy to see whats going on. However, I am a novice.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:17 AM.