2013-02-19 47 views
6

मैं रेडियो बटन में व्यक्तिगत विशेषताओं को कैसे जोड़ूं? जहां तक ​​मैं कह सकता हूं, केकपीएचपी केवल आपको समूह के सभी रेडियो बटनों में समान (सीमित) विशेषताओं को जोड़ने की अनुमति देता है।केकपीएचपी - अलग-अलग रेडियो बटनों में विशेषताओं को कैसे जोड़ा जाए?

उदाहरण के लिए इसे उत्पन्न करने के लिए कोई विचार, उदाहरण के लिए?

<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> 

उत्तर

-1

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

+0

आपको एक उदाहरण है कि मॉडल संघ के साथ रेडियो बटन के एक समूह को उत्पन्न करता है? क्या आप एक उदाहरण बना सकते हैं जो मैंने पोस्ट किया गया HTML उत्पन्न करता है? – BadHorsie

0

इस प्रयास करें:

$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); 

 संबंधित मुद्दे

  • कोई संबंधित समस्या नहीं^_^