Я следую этому примеру, но мне нужно добавить дополнительное текстовое поле к опции «Другое», которое активируется при установке флажка «Другое». Я могу добавить в форму отдельное текстовое поле и включить его с помощью кода JS, но как мне сгруппировать его вместе со значениями MultiCheckbox или группой флажков для определенного свойства определенного целевого_класса?
Форма
class FieldEducationAssignmentsForm extends Form
{
/**
* @var EntityManager
*/
protected $em;
public function __construct($name = null)
{
parent::__construct('Field Education Assignments');
$this->setAttribute('method', 'post');
$this->add(array(
'name' => 'id',
//'type' => 'Hidden',
'options' => array(
'label' => 'Id',
),
));
$this->add(array(
'type' => 'Hidden',
'name' => 'buildName',
'attributes' => array(
'value' => 'unknown'
)
));
$this->add(array(
'type' => 'Zend\Form\Element\MultiCheckbox',
'name' => 'directPractice',
'options' => array(
'label' => 'A. Check all direct practice field education assignments',
'object_manager' => $this->getEntityManager(),
'target_class' => ' OnlineFieldEvaluation\Entity\FieldEducationAssignments', //'YOUR ENTITY NAMESPACE'
'property' => 'directPractice', //'your db column name'
'empty_option' => '--- please choose ---',
'value_options' => array(
'1' => 'Adults',
'2' => 'Individuals',
'3' => 'Information and Referral',
'4' => 'Families',
'5' => 'Advocacy',
'6' => 'Treatment Planning',
'7' => 'Children',
'8' => 'Groups',
'9' => 'Community Networking Linkages',
'10' => 'Adolescents',
'11' => 'Couples',
'12' => 'Case Management',
'13' => 'Discharge Planning',
'14' => 'Diagnostic Assessment',
'15' => 'Older Adults',
'16' => 'Psychosocial Assessment',
'17' => 'Short Term Intervention',
'18' => 'Crisis Intervention',
'19' => 'Long Term Intervention',
'20' => 'Inter/Multidisciplinary Team Meetings',
'21' => 'Other (specify)'
),
),
'attributes' => array(
'value' => '1', //set checked to '1'
'multiple' => true,
)
));
$this->add(array(
'name' => 'otherDirectPracticeTxt',
'type' => 'Text',
'attributes' => array(
'disabled' => 'disabled',
),
));
...
}
Сущность
Подробнее здесь: https://stackoverflow.com/questions/284 ... eld-like-o
ZF2: Могу ли я прикрепить текстовое поле к мультифлажку? Как создать поле текстового поля, например «Другое» или «Коммен ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение