Yii:: Jquery Mask Input For Date etc..

Posted: September 3, 2010 in Php, Yii Framework

1. Download Masked Input Plugin by digitalBush

2. If you’re using Yii, create folder js outside the protected folder, store the js file inside there, put this code in your page.

<?php
$cs=Yii::app()->clientScript;
$cs->registerScriptFile(Yii::app()->baseUrl.’/js/jquery.maskedinput-1.2.2.js’,CClientScript::POS_HEAD);
?>

3. Then, assign the field to be masked

<SCRIPT language=”javascript”>

$(‘#date_1’).mask(“99-99-9999″,{placeholder:”_”});

</SCRIPT>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s