2amigos / yiiwheels

Widget extension library for the YiiStrap extension
http://yiiwheels.2amigos.us
Other
133 stars 77 forks source link

WhAceEditor don't work properly with TbActiveForm [ can't save nor validate data ] #61

Closed Daemeron closed 9 years ago

Daemeron commented 10 years ago

If used together with active record model validation doesn't work properly ie. no matter if you type something or not in required fields there is awalys the same error triggered which is field can not be empty. Furthermore it can't save any data i.e to database nor it can populate field with queried data. Here is my use scenario :

...
    <div class="control-group">
        <?php echo $form->labelEx($model,'content',array('class'=>'control-label')); ?>
        <div class="controls">
            <?php 
                $this->widget('yiiwheels.widgets.ace.WhAceEditor', array(
                    'model'=>$model,
                    'attribute'=>'content',
                    'value' => $model->isNewRecord ? '' : $model->content,
                    'htmlOptions'=> array('style' => 'height:450px','class'=>'span11'),
                    'mode'=>'html'
                ));
            ?>
            <?php echo $form->error($model,'content'); ?>
        </div>  
    </div>
...

Or maybe I'm doind it wrong ? If so please tell me how to fix it.

tonydspaniard commented 10 years ago

@Daemeron remove the value setting, it should be enough with the attribute. If the problem persists, let me know and I try to check it asap.

Daemeron commented 10 years ago

I was busy lately so forgive me for late reply. Yes problem persists. I just downloaded yiiwheels from a website, deleted old one, pasted new one, took the above code with value removed and it behaves the same as it was before. Field cannot be empty message all the time, it can't be prepopulated from database.It can't save to database. I'm not skilled enough to fix it myself so I will be depending on you guys.

tonydspaniard commented 9 years ago

@Daemeron I have updated yiiwheels to BS3, and made some tests: http://screencast.com/t/jboZh0ZJh2Fk

Everything seems correct, I believe is something to do with the way you set your rules.

PS: This is quite old, and I apologize for delay.