Commit 4e9dc981 by Qiang Xue

form WIP

parent a2594b7d
...@@ -14,11 +14,18 @@ return array( ...@@ -14,11 +14,18 @@ return array(
), ),
'depends' => array('jquery'), 'depends' => array('jquery'),
), ),
'yii/validation' => array(
'sourcePath' => __DIR__ . '/assets',
'js' => array(
'yii-validation.js',
),
'depends' => array('yii'),
),
'yii/form' => array( 'yii/form' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'yii-form.js', 'yii-form.js',
), ),
'depends' => array('yii'), 'depends' => array('yii', 'yii/validation'),
), ),
); );
\ No newline at end of file
/**
* Yii form widget.
*
* This is the JavaScript widget used by the yii\widgets\ActiveForm widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
!function ($) {
}(window.jQuery);
\ No newline at end of file
...@@ -75,6 +75,7 @@ class ActiveForm extends Widget ...@@ -75,6 +75,7 @@ class ActiveForm extends Widget
*/ */
public function init() public function init()
{ {
$this->options['id'] = $this->getId();
echo Html::beginForm($this->action, $this->method, $this->options); echo Html::beginForm($this->action, $this->method, $this->options);
} }
...@@ -84,6 +85,11 @@ class ActiveForm extends Widget ...@@ -84,6 +85,11 @@ class ActiveForm extends Widget
*/ */
public function run() public function run()
{ {
$id = $this->getId();
$options = array();
$options = json_encode($options);
$this->view->registerAssetBundle('yii/form');
$this->view->registerJs("jQuery('#$id').yii.form($options);");
echo Html::endForm(); echo Html::endForm();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment