Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7969375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:13:39+00:00 2026-06-04T07:13:39+00:00

public function actionCreate() { $model=new events; if(isset($_POST[‘events’])) { $model->event_title = $_POST[‘events’][‘event_title’]; $model->event_description = $_POST[‘events’][‘event_description’];

  • 0
public function actionCreate()
{
    $model=new events;      


    if(isset($_POST['events']))
    {

        $model->event_title         =   $_POST['events']['event_title'];
        $model->event_description   =   $_POST['events']['event_description'];
        $model->event_repeat_option =   $_POST['events']['event_repeat_option'];
        $model->event_start_date    =   date('Y-m-d H:i:s');
        $model->event_end_date      =   date('Y-m-d H:i:s');
        $model->user_id             =   yii::app()->user->getState('user_id');
        $model->deal_id             =   "1";
        $model->event_type          =   "1";
        $model->event_creation_date =   date('Y-m-d H:i:s');    


        if($model->save())
            $this->redirect(array('view','id'=>$model->event_id));
    }
}

Inserting multiple records? Why?
No Bug, No Error… Data is inserting Perfectly… but Multiple records at a time.

I did Print_r($model->attributes);

Array
(
    [event_status] => 1
    [event_title] => test1
    [event_description] => test1
    [event_repeat_option] => test1
    [event_start_date] => 2012-05-15 18:45:40
    [event_end_date] => 2012-05-15 18:45:40
    [user_id] => 3
    [deal_id] => 1
    [event_type] => 1
    [event_creation_date] => 2012-05-15 18:45:40
    [event_id] => 
)

… Everything is fine there but still some bug… can’t track it. Any suggestion?

Model Attributes

/**
 * This is the model class for table "user_events".
 *
 * The followings are the available columns in table 'user_events':
 * @property integer $event_id
 * @property integer $user_id
 * @property string $event_type
 * @property integer $deal_id
 * @property string $event_creation_date
 * @property string $event_start_date
 * @property string $event_end_date
 * @property string $event_title
 * @property string $event_description
 * @property integer $event_repeat_option
 *  *
 * The followings are the available model relations:
 * @property Deals $deal
 * @property RepeatOptions $eventRepeatOption
 * @property Users $user */
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:13:40+00:00Added an answer on June 4, 2026 at 7:13 am

    I think it’s because of AJAX validation witch is sending a request to the createAction (in your case). You can turn off ajax validation in your form widget like:

        $form = $this->beginWidget('CActiveForm', array(
            'id'=>'your-form',
            'enableAjaxValidation'=>false, //<- this is important      
        ));
    

    But if you really need ajax validation you can check for ajax requests in your controller like:

    public function actionCreate()
    {
    $model=new events;      
    
    
    if(isset($_POST['events']))
    {
        ... //Your stuff. Assigning attributes etc.
        if(!Yii::app()->request->isAjaxRequest){
            if($model->save())
                $this->redirect(array('view','id'=>$model->event_id));
        }
    }
    

    }

    In this case it will only save a record when its not an ajax request :). Try it out and i hope that’s what you’re looking for.

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Controller Action public function actionCreate() { $model=new News; $contentModel = new NewsContent; // if
public function bmdToStr(bmd:BitmapData,width:int,height:int):String { var encoder:JPEGEncoder = new JPEGEncoder(); var encBytes:ByteArray = encoder.encode(bmd); return
public function configure() { $this->widgetSchema['start_date'] = new sfWidgetFormInput(); $this->widgetSchema['end_date'] = new sfWidgetFormInput(); $this->validatorSchema->setPostValidator( new
Public Function Cricket() As List(Of String) Dim list2 As New List(Of String)() With {
Here is my controller public function login() { $this->load->model('admin_model'); $access = $this->admin_model->check_login(); $data['content'] =
public function action_xmlread() { $xml = simplexml_load_file('new.xml'); foreach($xml->body as $b) { foreach ($b->node as
public function insert_data($array){ $db = new MySQLi(HOST,USER,PASS,DB); $var = adam; $stmt = $db->stmt_init(); $query
public function getAllEventsByDate($allEvents, $date) { $theEvents = array(); foreach ($allEvents as $event) { if
Public Function MethodOne(ByVal s As String) As String Dim sb As New StringBuilder() sb.Append(s)
If I do this public function indexAction() { $view = new Zend_View(); $registrationForm =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.