2013-02-19 13 views
6

Tek tek özellikleri radyo düğmelerine nasıl ekleyebilirim? Anlayabildiğim kadarıyla, CakePHP sadece gruptaki tüm radyo düğmelerine aynı (sınırlı) öznitelikleri eklemenizi sağlar.CakePHP - Tek tek radyo düğmelerinin nitelikleri nasıl eklenir?

Bunun nasıl üretileceğine dair herhangi bir fikir, örneğin?

<input type="radio" checked="checked" value="0" name="data[MyModel][field]" id="custom-id-1" class="custom-class-1" data-something="test1"> 
<label for="custom-id-1">Test 1</label> 
<input type="radio" checked="checked" value="0" name="data[MyModel][field]" id="custom-id-2" class="custom-class-2" data-something="test2"> 
<label for="custom-id-2">Test 2</label> 

cevap

-1

echo $this->Form->input('title', array('type' => 'radio', 'class' => 'custom-class', 'atributeName' => 'attributeValue'));

+0

modeli ilişkilendirmesi ile radyo düğmeleri grubu oluşturan bir örnek var mı? Gönderdiğim HTML'yi oluşturan bir örnek yapabilir misiniz? – BadHorsie

0

bu deneyin:

$options = array('1' => 'Test 1'); <br> $attributes = 
array('value'=>'1','class'=>'custom-class-1','id'=>'custom-id-1','data-something'=>'test1'); 

echo $this->Form->radio('field_name1', $options, $attributes); 

--------------------- 


$options = array('1' => 'Test 2'); <br> $attributes = 
array('value'=>'1','class'=>'custom-class-2','id'=>'custom-id-2','data-something'=>'test2'); 

echo $this->Form->radio('field_name2', $options, $attributes); 
İlgili konular