PHP Development Framework Yii Framework Tutorial (zii) Component-datepicker Example

Source: Internet
Author: User
Tags php framework
Cjuidatepicker is used for date input, which encapsulates the Jui DatePicker plug-in with the following basic usage:

<!--? php echo $form--->errorsummary ($model),?>   <!--? php $this--->widget (' Zii.widgets.jui.CJuiDatePicker ', Array (    ' name ' = ' my_date ',    ' language ' = ' en ', '    options ' = Array (                //' show ' (the default), ' Slidedown ', ' fadeIn ', ' fold '                showanim ' + ' fold ',                ' showon ' = ' Button ',//' Focus ', ' button ', ' both '                buttontext ' = ' Select form calendar ',                ' buttonimage ' = ' images/ Calendar.png ',                ' buttonimageonly ' =>true, '            htmloptions ' =>array (                ' style ' = ' width ') : 80px;vertical-align:top '                ),)            ;   ? > Endwidget (?>);

To get the date entered, first assign a value to the Name property of Cjuidatepicker, this example is my_date, and then define Datamodel

Class Datamodel extends cformmodel{public    $my _date;}

When the user submits, displays the date entered by the user, modifies the Sitecontroller's Actionindex

Public Function Actionindex () {      $model =new datamodel ();      if (!empty ($_post[' my_date '))    {        $model->my_date=$_post[' my_date '];          if ($model->validate ()) {            $this->render (' result ', array (                ' model ' = = $model,                  ));           return;        }      }      $this->render (' index ', array (            ' model ' = $model,              ));}

The above is the content of the PHP Framework Yii Framework Tutorial (ZII) component-datepicker sample, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.