Note that there are some explanatory texts on larger screens.

plurals
  1. POyii, CactiveForm checkboxlist
    primarykey
    data
    text
    <p>im really trying to render a checkboxlist, never did make a try on it before so im having problems with it, im trying to render all the checkboxes foreach column or attribute made, this is the action controller:</p> <pre><code>public function actionCreate() { $model=new Parametro; $variable = file_get_contents('protected\column.txt'); $vars = explode(' ', $variable); // Uncomment the following line if AJAX validation is needed // $this-&gt;performAjaxValidation($model); if(isset($_POST['Parametro'])) { $model-&gt;attributes=$_POST['Parametro']; if($model-&gt;save()) $this-&gt;redirect(array('view','id'=&gt;$model-&gt;id)); } $this-&gt;render('create',array( 'model'=&gt;$model, 'variable'=&gt;$vars, )); } </code></pre> <p>this is the model with another some methods</p> <pre><code>public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. $variable = file_get_contents('protected\column.txt'); return array( array('parametro_id', 'required'), array('parametro_id', 'numerical', 'integerOnly'=&gt;true), // The following rule is used by search(). // @todo Please remove those attributes that should not be searched. array('id, parametro_id', 'safe', 'on'=&gt;'search'), array($variable, 'safe', 'on'=&gt;'search'), ); } public function generateAttributeLabel($variable = null) { if($variable) { $variable = file_get_contents('protected\column.txt'); } return $variable; } public function attributeLabels() { return array( 'id' =&gt; 'ID', 'parametro_id' =&gt; 'Parametro', ); } </code></pre> <p>the form where im trying to make the checkboxlist</p> <pre><code>&lt;div&gt; &lt;?php echo $form-&gt;checkboxList($model, $variable, array(0 =&gt; 1)); ?&gt; &lt;/div&gt; </code></pre> <p>and the content of the file if you ask</p> <pre><code>lololo trying </code></pre> <p>the are some columns that are being generated automatically and im storing their names on this file separated by spaces, everything seems to be fine until i got to the checkboxlist on form, it gives me error like strpos() or something, how can i make this checkbox to render and to save 1 data to thoses who are checked by specific columns?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload