Reputation: 2561
I want to display form with custom property mainly enctype in YII.
I have written code in my one of the view file.
$form = $this->beginWidget('GxActiveForm', array(
'id' => 'regulation-form',
//'enctype'=>'multipart/form-data',
'enableAjaxValidation' => false,
));
but it will render like this
<form id="regulation-form" method="post" action="my action">
I want result like
<form id="regulation-form" method="post" action="my action" enctype='form/multi-part'>
Upvotes: 0
Views: 440
Reputation: 437376
Assuming that GxActiveForm
extends CActiveForm
, you need to use the htmlOptions
attribute:
$form = $this->beginWidget('GxActiveForm', array(
'id' => 'regulation-form',
'htmlOptions' => array('enctype'=>'multipart/form-data'),
'enableAjaxValidation' => false,
));
Upvotes: 2
Reputation: 15981
You need to write your form widget as below
$form = $this->beginWidget('GxActiveForm', array(
'id' => 'regulation-form',
//'enctype'=>'multipart/form-data',
'enableAjaxValidation' => false,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
));
Upvotes: 1