foreach($result as $i=>$item) {
echo $form->field($item,"[$i]candidad");
}
and I have error
Call to a member function formName() on array
from
in C:\xampp\htdocs\yii2_tools\vendor\yiisoft\yii2\helpers\BaseHtml.php at line 2096
2087208820892090209120922093209420952096209720982099210021012102210321042105 * See [[getAttributeName()]] for explanation of attribute expression.
*
* @param Model $model the model object
* @param string $attribute the attribute name or expression
* @return string the generated input name
* @throws InvalidParamException if the attribute name contains non-word characters.
*/
public static function getInputName($model, $attribute)
{
$formName = $model->formName();
if (!preg_match('/(^|.*\])([\w\.]+)(\[.*|$)/', $attribute, $matches)) {
throw new InvalidParamException('Attribute name must contain word characters only.');
}
$prefix = $matches[1];
$attribute = $matches[2];
$suffix = $matches[3];
if ($formName === '' && $prefix === '') {
return $attribute . $suffix;
} elseif ($formName !== '') {
2. yii\base\ErrorHandler::handleFatalError()
problem is in this line -> $formName = $model->formName();
I think $result = $sql -> queryAll(); not give all params like $result = app\models\FormX::find()->all(); because for $result = app\models\FormX::find()->all(); work perfect.