사실 젠드 프레임 워크 2가 양식 요소 용 HTML을 생성하는 방법을 이해할 수 없습니다.젠드 프레임 워크 2 폼에서 체크 박스 그룹을 커스터마이징하는 방법은 무엇입니까?
<label><input type="checkbox" value="1" name="others[]">Contacts</label>
<label><input type="checkbox" value="2" name="others[]">Who viewd my profile</label>
그러나 나는 다음과 같이 HTML을해야 - - 예를 들어,
$others = new Element\MultiCheckbox('others');
$others->setLabel('Others')
->setAttribute('name', 'others');
$others->setValueOptions(array(
'1' => 'Contacts',
'2' => 'Who viewd my profile'
));
이 코드는 생성 어떻게, 내가 생성 된 HTML을 변경하려는 경우 그래서
<input type="checkbox" value="1" name="others[]"><label>Contacts</label>
<input type="checkbox" value="2" name="others[]"><label>Who viewd my profile</label>
내가한다?
http://stackoverflow.com/questions/13931834/ zend-framework-2-form-element-decorators – Orangepill
나는 체크했으나 여전히 체크 박스 그룹에 대한 해결책을 얻지 못했다. 일부는 사용자 정의 할 수 있지만 확인란 그룹은 사용할 수 없습니다. echo $ this-> formElement ($ elements [ 'others']);를 작성할 때; 항상 그 코드 그룹을 생성합니다. –
아마도'$ others-> setAttribute ('name', 'others') -> setLabel ('Others'); ' – Amir