Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

mint's Achievements


Newbie (1/14)



  1. Is there any way to validate a normal chtml text field(Chtml::textField declared without any model class) and display a message on he same page if the user leaves it blank and clicks a submit button. Here is the code <?php echo CHtml::beginForm(array('transaction/disp'),'Post'); ?> <div class="row"> <?php echo CHtml::label('Transaction Status','trst'); ?> </div> <div class="row"> <?php echo CHtml::textField('trst','',array('id'=>'trst','size'=>10)); ?> </div> <?php echo CHtml::submitButton('Submit', array('id'=>'submit','name'=>'submit')); ?> <?php echo CHtml::endForm(); ?>
  2. I have not found it on the docs anywhere, but it was mentioned in the yii framework forum by some one as an example and I think this tag was for a drop down list. Can you suggest some other html option for radio button to do this task.
  3. I want to enable a text field and button when the user selects a radio button, I have tried the following code but not working. echo CHtml::textField('trid','',array('id'=>'trid','size'=>7,'disabled'=>true)); echo CHtml::submitButton('Submit', array('id'=>'submit','name'=>'submit','disabled'=>true)); echo('<b>Dispaly records acoording to status number.</b>'); echo CHtml::radioButton('status',false,array( "success"=>"function(){ $(#trid).attr('enabled',true)';} $(#submit).attr('enabled',true)';", ));
  4. mint


    There is a for loop which iterates and displays some links, the number of links depends on a database value which lies in range of 100's, is there any way to paginate the links to display 10 links one at a time through pagination. Here is the code foreach ($records as $record): echo CHtml::link('Transaction ID #'.$record->RBT_Transaction_ID,array('mobdistinct','mobtrans'=>$record->RBT_Transaction_ID)); ?> <br> <?php endforeach; ?>
  5. mint

    Creating User

    The problem was that there was a drop down list which already had some value and whenever some value was entered in the ID(Primary Key) field it automatically got stored in the database with ID value and drop down list value because the create action method in UserController class checks for the _POST['User'] , I think as the two fields were set, it automatically updates the database so whenever the submit button was clicked there was a duplicate value for the primary key and a exception was generated, so I changed the code to check both, is the form fields been entered and the submit button clicked if(isset($_POST['User']) && isset($_REQUEST['cu'])) .
  6. mint

    Creating User

    Now the problem is solved
  7. I am unable to create a user through the application, I am getting the exception that CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2001128' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO `tbl_user` (`id`, `name`, `surname`, `username`, `password`, `access`, `email`, `contact`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7) But I checked the database there was no entry for that primary key, also only the primary gets inserted into the database after submitting the form. I have created a permission hierarchy using rbac. A superadmin can create admin and normaluser, a admin1 can create only normaluser.
  8. The columns in the view page are going out of range of the normal page width. I am using grid view to display the rows of the database but the columns do not fit in the page width. here is the grid view $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'transaction-grid', 'dataProvider'=>$dataProvider, //'filter'=>$model, 'columns'=>array( 'RBT_Transaction_ID', 'Transaction_Timestamp', 'Bearer_ID', 'Transaction_Leg', 'Transaction_Status', 'RBT_Status_Message', 'Tone_ID', 'Transaction_Type', 'Tone_Type', 'Response_Status_Code', 'Response_Status_Message', 'Subscriber_MSISDN', 'Special_Caller', 'FeatureCode', 'FeatureFlag', 'Song_Name', 'Subscription_Charge', 'Applied_Subscription_Pack', 'Applied_Charging_Pack', ), ));
  9. Thanks, the problem is solved. I did this in the UserIdentity if($user->access==='0') { if(!Yii::app()->authManager->isAssigned('superadmin',$this->_id)) { Yii::app()->authManager->assign('superadmin', $this->_id); } } else if($user->access==='1') { if(!Yii::app()->authManager->isAssigned('admin1',$this->_id)) { Yii::app()->authManager->assign('admin1', $this->_id); } } else if($user->access==='2') { if(!Yii::app()->authManager->isAssigned('normaluser',$this->_id)) { Yii::app()->authManager->assign('normaluser', $this->_id); } } And Checked if the user has the permission in the respective action
  10. I have created Rbac with superadmin,admin1,normaluser. I want to check weather the user is logged in as superadmin, admin1,normaluser depending on the database column "access" value in tbl_user table, if "access"=0 then user should be superadmin, if "access"=1 then user should be admin1 and if "access"=2 then user should be normaluser. RBAC authorization hierarchy was created by yiic shell, all the database schema has been defined. I cannot figure out how to proceed further than creating authorization hierarchy and how to write code to check a user according to roles. Here is RbacCommand.php http://pastebin.com/BKdYM4eg
  11. Thanks Antonio Conte that solved the problem.
  12. I have entered username and password directly in the database, now when i try to login with the data values in the default login page it shows UNKNOWN_IDENTITY error. I have printed out the error code in the log file, it shows error code is 100 which is i think is unknown identity error, the application is showing the default error which is unknown identity. Here is UserIdentity.php http://pastebin.com/emWFEwZc Here is LoginForm.php http://pastebin.com/r8WxW0CQ Here is SiteController.php http://pastebin.com/VYL3DcXV Here is login.php http://pastebin.com/0BhbhbmU
  • Create New...