sintonia/airtime_mvc/application/forms/AddShowWhat.php
James Moon e5969ab4be CC-2232:Automatically fill in show name
Notes:
1. Not sure if "Untitled Show 1" would be the best name.
 What if "Untilted Show 1" already exist? There is no easy way
of keeping track of the numbers. So wouldn't it be better to just use
"Untitled Show"?
2. There is no easy way to figure out if the current form is
opened for "update" or "add".( We can check the text on the button
if it says "add" or "update" button, but it's always bad to rely on
 any UI text. So the new code will focus and higlight name text on both
update and create new case for now.
2011-05-04 20:52:03 -04:00

59 lines
1.7 KiB
PHP

<?php
class Application_Form_AddShowWhat extends Zend_Form_SubForm
{
public function init()
{
// Hidden element to indicate whether the show is new or
// whether we are updating an existing show.
$this->addElement('hidden', 'add_show_id', array(
'decorators' => array('ViewHelper')
));
// Add name element
$this->addElement('text', 'add_show_name', array(
'label' => 'Name:',
'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty'),
'value' => 'Untitled Show 1'
));
// Add URL element
$this->addElement('text', 'add_show_url', array(
'label' => 'URL:',
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
// Add genre element
$this->addElement('text', 'add_show_genre', array(
'label' => 'Genre:',
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim')
));
// Add the description element
$this->addElement('textarea', 'add_show_description', array(
'label' => 'Description:',
'required' => false,
'class' => 'input_text_area'
));
$descText = $this->getElement('add_show_description');
$descText->setDecorators(array(array('ViewScript', array(
'viewScript' => 'form/add-show-block.phtml',
'class' => 'block-display'
))));
}
}