Indeks odchudzicsiePubliczny Ośrodek Zdrowia KrakówPublic Relations studia podyplomowePubliczna Szkoła w Aleksandrowie Kujawskimpublic relations praca magisterskaPubliczna Biblioteka Nowy SączPublic Choice New Orleanspubliczna przychodnia na SadybiePublic Choice IIIPublic Relations PRPubliczna Szkoła Muzyczna
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • ninue.xlx.pl
  •  

    odchudzicsie

    With the latest snapshop of 1.0, the validation for checkbox never validate. There is no error message, but validate() still is false.

    minimal example Spoiler controllers/TestController.php<?php class TestController extends BaseController { public function actionIndex() { $form = new TestForm; if(isset($_POST['TestForm'])) { $form->attributes = $_POST['TestForm']; if ($form->validate()) { $this->renderText('ok'); return; } } $this->render('test', array('form'=>$form)); } } ?>
    models/testForm.php<?php class TestForm extends CFormModel { public $check; public function rules() { return array( array('check', 'required', 'requiredValue'=>true), ); } public function safeAttributes() { return array( 'check', ); } } ?>
    views/test/test.php<?php echo CHtml::beginForm(); echo CHtml::errorSummary($form); echo CHtml::ActiveCheckBox($form, 'check'); echo CHtml::submitButton('Submit'); echo CHtml::endForm(); ?>




    You don't need another array to specify 'index' option.



    Thank you very much, Qiang, it works like a charm now:

    public function relations()
    {
    return array(
    'users' => array(self::MANY_MANY, 'User', 'Promotion_User(promotionId, userId)'),
    'winners' => array(self::MANY_MANY, 'User', 'Promotion_Winner(promotionId, userId)'),
    'winnersData' => array(self::HAS_MANY,'Promotion_Winner','promotionId','index'=>'userId'),
    );
    }


    <?php echo CHtml::encode(Yii::app()->dateFormatter->formatDateTime($model->winnersData[$winner->userId]->promotionWinnerRaffleDate,'medium','')); ?>

    cheers!!
    :D



    here is a quick walk-through:

    config/main.php
    'components'=>array( ... 'errorHandler'=>array( 'errorAction' => 'site/error' ), ... ),

    controllers/SiteController.php
    public function actionerror() { $error = Yii::app()->errorHandler->error; if( $error ) { $this -> render( 'error', array( 'error' => $error ) ); } }

    views/site/error.php
    <div class="errorSummary"> <p> Sorry, it seems like a(n) <?= $error['code']; ?> error has occured during your request. </p> <p><strong>Message:</strong> <?= $error['message']; ?></p> </div>

    I hope this helps.

    --iM



    'static' should be useful for you
    class vars { public static $data; } vars::$data['str1']='val1'; echo vars::$data['str1']; class someClass { public function someMethod() { echo vars::$data['str1']; } } echo '..'; $a=new someClass(); $a->someMethod();
    output is val1..val1

    also
    Yii::app()->session[];
    is cool ;)



    Hello guys

    I can't get my actionerror working

    my main.php
    'components'=>array( 'errorHandler'=>array( 'errorAction'=>'site/error', ),

    My SiteController:
    public function actionerror() { if($error=Yii::app()->errorHandler->error) { $this->render('exception', array( 'error' => $error)); } }

    My error occurs insinde a module controller. Is it wrong?

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • frania1320.xlx.pl
  •