Yii Framework Forum: How To Call Ajax - Yii Framework Forum

Jump to content

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

How To Call Ajax Rate Topic: *---- 1 Votes

#21 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:11 AM

It display on setting page
0

#22 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:12 AM

hi

it's open a below a setting page or repalce the setting page? in your change password form
how would be open in your porject?
Thanks,
Ankit Modi
Skype : amodi06
0

#23 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:13 AM

open in below setting page
0

#24 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:14 AM

which one i mean controller or something?
0

#25 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:16 AM

in controller your password action and setting page when you display password from
Thanks,
Ankit Modi
Skype : amodi06
0

#26 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:19 AM

View PostAnkit Modi, on 21 May 2013 - 07:16 AM, said:

in controller your password action and setting page when you display password from

Attached File(s)


0

#27 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:22 AM

ok

u can change the function

public function actionPassword($id) {
        
        $user = app()->user->getUser();
        if (isset($user->id) && $user->id === $id || app()->user->isAdmin()) {
            $model = $this->loadModel($id);
            $model->setScenario('changePassword');
            if (isset($_POST['User'])) {
                $model->attributes = $_POST['User'];
                if ($model->validate()) {
                    $model->password = crypt($_POST['User']['pass1'], Randomness::blowfishSalt());
                    if ($model->save()) {
                        app()->user->setFlash('success', 'Saved new password!');
                        $this->redirect(array('update', 'id' => $model->id));
                    }
                }
            }

            //$this->render('/user/password', array('model' => $model));
//            $this->renderPartial('/user/password', array('model' => $model),false,true);
        } else {
            // access denied for this user
            throw new CHttpException(403, 'Access Denied.');
        }
	 $this->renderPartial('/user/password', array('model' => $model),false,true);
    }

Thanks,
Ankit Modi
Skype : amodi06
0

#28 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:24 AM

and setting.php please correct the syntax u can pass a id using wrong syntax

<?php echo CHtml::ajaxlink('Change Password', array('/user/password', 'id' =>Yii::app()->user->id), array('update' => '.inner_tab_contant'), array("live" => false)); ?>

Thanks,
Ankit Modi
Skype : amodi06
0

#29 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:29 AM

View PostAnkit Modi, on 21 May 2013 - 07:24 AM, said:

and setting.php please correct the syntax u can pass a id using wrong syntax

<?php echo CHtml::ajaxlink('Change Password', array('/user/password', 'id' =>Yii::app()->user->id), array('update' => '.inner_tab_contant'), array("live" => false)); ?>


Now also showing new page and submit button action is not working.
0

#30 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:31 AM

Ok sorry..

so u can revert the function and it's display the setting page or not?
Thanks,
Ankit Modi
Skype : amodi06
0

#31 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:33 AM

and also remove the inner_tab_content div in your password page


<?php
/* @var $this UserController */
/* @var $model User */

if($model->id===app()->user->id){
    $breadcrumbs = array(
        'Profile' => array('/user/update', 'id' => app()->user->id),
        'Change Password'
    );
} else {
    $breadcrumbs = array(
        'Users' => array('/user/index'),
        $model->email => array('/user/update', 'id' => $model->id),
        'Change Password'
    );
}

//$this->layout = app()->user->isAdmin()?'column2':'';
//$this->pageTitle = app()->name . ' - Change Password';
//$this->breadcrumbs = $breadcrumbs;

$this->menu=array(
	array('label'=>'List User', 'url'=>array('index')),
	array('label'=>'Create User', 'url'=>array('create')),
);
?>

<!--<h1>Change <?php echo $model->email; ?> Password</h1>-->

<p>Fields with <span class="required">*</span> are required.</p>

    <?php
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        
        'id' => 'changePass-form',
        'type' => 'horizontal',
        'enableAjaxValidation' => false,
        'clientOptions' => array(
                'validateOnSubmit' => true,

            ),
        'htmlOptions' => array(
                'onsubmit' => "return false;",
            ),


    ));
    ?>

    <?php //echo $form->errorSummary($model); ?>

    <fieldset>

        <?php if(!app()->user->isAdmin()): ?>

            <?php echo $form->passwordFieldRow($model, 'old_password', array('size' => 60, 'maxlength' => 63)); ?>

        <?php endif; ?>

        <?php echo $form->passwordFieldRow($model, 'pass1', array('size' => 60, 'maxlength' => 63)); ?>

        <?php echo $form->passwordFieldRow($model, 'pass2', array('size' => 60, 'maxlength' => 63)); ?>

    </fieldset>

    <div class="form-actions">
        <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'label'=>'Change Password')); ?>
        <?php echo CHtml::link('Link Text',array('user/password?id=942'),array('class'=>'aa','onclick'=>'test()')); ?>
     
    </div>
    
    <?php $this->endWidget(); ?>

Thanks,
Ankit Modi
Skype : amodi06
0

#32 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:33 AM

It's displaying on setting page but submit button action is not working
0

#33 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:38 AM

ok it's diaplay password error(validation rule) or not?
Thanks,
Ankit Modi
Skype : amodi06
0

#34 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:43 AM

No, it diplaying submit button and its not working and one more link is displaying "Link Text" when click this link it saying Error403: Access denied.
0

#35 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:48 AM

ooh..sorry

just remove the link text after submit button on your password page and thenafter click the submit button
please let me know it's display the error or not?

and also try the chnage code

<?php
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        
        'id' => 'changePass-form',
	'action'=>'password'
        'type' => 'horizontal',
        'enableAjaxValidation' => false,
        'clientOptions' => array(
                'validateOnSubmit' => true,

            ),
        'htmlOptions' => array(
                'onsubmit' => "return false;",
            ),


    ));
    ?>

Thanks,
Ankit Modi
Skype : amodi06
0

#36 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:53 AM

Sir, its not displaying any error, only submit button action action is not working.
0

#37 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:55 AM

can u pass the right syntax, please check

$this->renderPartial('/user/password', array('model' => $model),false,true);

Thanks,
Ankit Modi
Skype : amodi06
0

#38 User is offline   Devendra411 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-April 13
  • Location:Bangalore

Posted 21 May 2013 - 07:57 AM

yah, i written correctly.
0

#39 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 07:58 AM

ok can u send the again code if u don't mind?
Thanks,
Ankit Modi
Skype : amodi06
0

#40 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 891
  • Joined: 19-February 13
  • Location:India

Posted 21 May 2013 - 08:11 AM

Hi

u can try the my action

public function ChangePassword($id){
		$model=Users::model()->findByPk((int)$id);
		
		if(isset($_POST['Users']['password']) && !empty($_POST['Users']['password']))
		{
			
			$modelForm->password_repeat = $_POST['Users']['password_repeat'];

			$model->password=md5($modelForm->password_repeat);
			$model->save(false);


			if (!$model->hasErrors()) {
				$this->redirect(array('admin'));
			}else {
				Yii::app()->user->setFlash('error', "Password change failure!");
				$this->redirect(array('admin'));
			}
		}
		$this->render('/users/password',array('model'=>$model));

	}

Thanks,
Ankit Modi
Skype : amodi06
0

Share this topic:


  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users