我使用Zend_form(Zend Framwork的一部分)創建一個表單,並在使用Zend_Form的多元框元素(Zend_Form_Element_MultiCheckbox)添加一組複選框時輸出如下代碼:zend form for multicheckbox從標籤中刪除輸入
<label for="subjects-maths">
<input type="checkbox" value="maths" id="subjects-maths" name="subjects[]">
Maths
</label>
<label for="subjects-english">
<input type="checkbox" value="maths" id="subjects-english" name="subjects[]">
English
</label>
iee輸入在標籤內。儘管代碼在技術上是可行的,但就W3c的看法而言,這是違背良好做法的,並且也不是我想要的方式,因爲它使得樣式更難。我想是這樣的:
<div>
<label for="subjects-maths">
Maths
</label>
<input type="checkbox" value="maths" id="subjects-maths" name="subjects[]">
</div>
<div>
<label for="subjects-english">
English
</label>
<input type="checkbox" value="maths" id="subjects-english" name="subjects[]">
</div>
因此如何移動的複選框輸入了標籤,如何包圍的div每個選項。我在互聯網上查看了所謂解決方案的許多頁面,但沒有一個適用於多個複選框,因爲它只針對周圍的標籤(即本例中將說明主題的標籤)而不是實際的選項標籤和輸入。
請幫忙。
感謝 保羅
嘗試這樣做,這是行不通的 – AdrenalineJunky 2011-06-06 10:52:42
不起作用,因爲multiCheckBox是一個包含多個複選框的複雜元素。這些複選框裝飾器是硬編碼的。 – LittleBigDev 2012-10-05 00:25:02