views:

44

answers:

2

Hi, I have esthetic's problem.
Zend Form not in place label value, how to move them that they will be exactly above text box, and not from left?

(I didn't put filters and validation to make this code simpler here)

My Code Login.php form:

public function init()
{
  $username = new Zend_Form_Element_Text('username');
  $username->setLabel("username");
  $password = new Zend_Form_Element_Password('password');
  $password->setLabel('password');
  $this->addElements(array($username, $password));
}

Thanks,

Yosef

+1  A: 

You can use form decorators to adjust this: Zend Framework: Standard Form Decorators

ctshryock
Thank you very much ctshryock
Yosef
+1  A: 

Without changing the decorators you could also use css to position your form elements. Exemple:

dl.zend dt, dd { min-height: 30px; }
dl.zend_form dt {
    float: left;
    clear: left;
    text-align: right;
}
dl.zend_form dt label.required { font-weight: 600; }
dl.zend_form dd {
    float: left;
    clear: right;
    padding-left: 5px;
}

dl.zend_form dd ul.errors {
    list-style: none;
    padding: 0;
    margin: 0;
}

dl.zend_form dd ul.errors li {
    float: left;
    margin: 0 0.15em;
    font-size: 12px;
    color: #666666;
}
Iznogood
thank you very much!
Yosef