make password



i want to make validasi password to download. in my attachment have a password. if everyone to download, he must input a password. nach! i use CActiveForm and i use method get and action to /download; like that my code


<div class="form">


  <?php $form=$this->beginWidget('CActiveForm', array(










	)); ?>


    <h1>Judul <?php echo $model->downtitle; ?></h1>

        <div class="row">

            <?php  if($model->downpassword!=""){?>

                    <div class="row">


                    	<?php echo $form->hiddenField($model,'downid')?>

                        <?php echo $form->hiddenField($model,'downpassword')?>

                        <?php echo $form->labelEx($model,'Masukkan Password'); ?>

                        <?php echo $form->passwordField($model,'Password') ?>



                    <div class="row buttons">

                        <?php echo CHtml::submitButton('Download'); ?>



	 	    <?php }else {

                    echo 'silahkan download ';

                    echo CHtml::link($model->downurl,array('displaySavedImage','id'=>$model->downid));




            <div class="row">

                nilai <?php echo CHtml::encode($data->valPass); ?>



        </div><!-- form -->

<?php $this->endWidget(); ?>


in my controler

public function actionDownload()


		$model=new Down;

		// if it is ajax validation request

		if(isset($_POST['ajax']) && $_POST['ajax']==='log-form')


			echo CActiveForm::validate($model);



















i have problem in this.

this value always same $_POST[‘Password’] and $_POST[‘downpassword’]

can you all help me, how to get value from my database and inputan so that i can different this value. thanks

$_POST[‘Down’] holds the whole form values…

$_POST[‘Down’][‘password’] is the password

$_POST[‘Down’][‘downpassword’] is the downpassword

But your code is not good… as anybody that would take a look at the HTML source… would read the download password…

You need a form to just get the password, without the hidden field downpassword…

in the actionDownload you get the downpassword from the database and compare to the entered password…


if you do


you can use


thanks you.

i have other problem. i cann’t get value rom CJuiDatePicker. the value always 0

this my code:

<div class="row">

     <?php echo $form->labelEx($model,'Time Expiyed'); ?>


		$this->widget('zii.widgets.jui.CJuiDatePicker', array(




		'language'=>Yii::app()->language=='et' ? 'et' : null,


			'showAnim'=>'fold', // 'show' (the default), 'slideDown', 'fadeIn', 'fold'

			'showOn'=>'button', // 'focus', 'button', 'both'

			//'buttonText'=>Yii::t('ui','Select form calendar'), 








<?php echo $form->error($model,'newsdtime'); ?>


can you help me again? hee :smiley: thanks before

For new / different problems, please open new threads in the future

As for the problem with the date… the code seems OK to me… could be that you don’t have a validation rule for this field and that’s why its always 0 ?

this my rules

return array(

			array('newstitle, newstext','required'),

			array('active', 'numerical', 'integerOnly'=>true),

			array('newstitle', 'length', 'max'=>255),

			array('newstext', 'length', 'max'=>4096),

			array('newstitle', 'safe', 'on'=>'search'),


any problem ?

i donn’t know what must i do :-/

thanks you mdomba. i have been make new post about this but I donn’t know the result. so may be you more know than me :-D, heehee . thank a lot of friend

oh y.

how must i make a validation rule ?

This explains all about massive assignment -

if i use $model=>$_POST[‘Down’] the value of $model->downpassword is empty. it is my reason use that. but i think it’is enough if i post it’s downid only . what are you opinian? any ide :-/