Posts Tagged with form

Displaying 1-10 of 17 results.
Resolved: Yii2 ActiveForm password autocomplete off chrome not working
posted by admin on June 9, 2017
I have ActiveForm in Yii2 and password section and username filled automatically and autocomplete="off" not working on Chrome

<?php $form = ActiveForm::begin([
'options' => [
//'autocomplete' => 'off'
],
]); ?>
. . .
<div class="row">
<div class="col-md-12">
<?= $form->field($model, 'password_change')->passwordInput(['maxlength' => true, 'autocomplete' => 'off'])->label('password') ?>
</div>
</div>
. . .
<?php ActiveForm::end(); ?>
Read more
Resolved: PHP check time 00:00:00 from datetime
posted by admin on November 21, 2016
I have datetime from MySQL db in format Y:m:d H:i:s like

2014-11-02 02:04:05
2014-11-02 00:00:00
etc ...

I want to check, if time from datetime equal "00:00:00", then return or echo only date.
Result

2014-11-02 02:04:05
2014-11-02
Read more
Wiki: Css3 spin icon with originwiki
posted by admin on November 7, 2016
HTML:

<h1 class="text-center">
<span class="glyphicon glyphicon-refresh spin"></span>
<span class="glyphicon glyphicon-record spin"></span>
<span class="glyphicon glyphicon-send spin"></span>
<span class="glyphicon glyphicon-star spin"></span>
</h1>

<h3 class="text-center">
<span class="glyphicon glyphicon-refresh spin"></span>
<span class="glyphicon glyphicon-record spin"></span>
<span class="glyphicon glyphicon-send spin"></span>
<span class="glyphicon glyphicon-star spin"></span>
</h3>

<h6 class="text-center">
<span class="glyphicon glyphicon-refresh spin"></span>
<span class="glyphicon glyphicon-record spin"></span>
<span class="glyphicon glyphicon-send spin"></span>
<span class="glyphicon glyphicon-star spin"></span>
</h6>

CSS3:

.spin {
-webkit-animation: spin .2s infinite linear;
-moz-animation: spin .2s infinite linear;
-o-animation: spin .2s infinite linear;
animation: spin .2s infinite linear;
-webkit-transform-origin: 50% 58%;
transform-origin:50% 58%;
-ms-transform-origin:50% 58%; /* IE 9 */
}

@-moz-keyframes spin {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
}
}

@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}

@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
Read more
Resolved: Yii 1.1 listdata multiple fields
posted by admin on October 25, 2016
I have form with select box, and want to generate options with multiple columns.
Now:

$criteria = new CDbCriteria();
...//if you have criteria condition
$type_list=CHtml::listData(Paper::model()->findAll($criteria),'id','title'); ?>
<?php echo $form->dropDownList($model, 'paper_id', array(''=>Yii::t('t', 'Выберите бумагу'))+$type_list, array('options' => array($model->paper_id=>array('selected'=>true)))); ?>

In output i see:
  • Title 1
  • Title 2
  • etc...
  • Title N


But I want multiple columns, and want to see output like this:
  • Title 1, field 1, another field 1, etc...
  • Title 2, field 2, another field 2, etc...
  • ...
  • Title N, field N, another field N, etc...
Read more
Wiki: Bootstrap Form Inputswiki
posted by admin on October 12, 2016
Supported Form Controls
Bootstrap supports the following form controls:
  • input
  • textarea
  • checkbox
  • radio
  • select


Bootstrap Input
Bootstrap supports all the HTML5 input types: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color.
Note: Inputs will NOT be fully styled if their type is not properly declared!

<div class="form-group">
<label for="usr">Name:</label>
<input type="text" class="form-control" id="usr">
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd">
</div>


Bootstrap Textarea
The following example contains a textarea:

<div class="form-group">
<label for="comment">Comment:</label>
<textarea class="form-control" rows="5" id="comment"></textarea>
</div>

Bootstrap Checkboxes
Checkboxes are used if you want the user to select any number of options from a list of preset options.

The following example contains three checkboxes. The last option is disabled:

<div class="checkbox">
<label><input type="checkbox" value="">Option 1</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="">Option 2</label>
</div>
<div class="checkbox disabled">
<label><input type="checkbox" value="" disabled>Option 3</label>
</div>

Use the .checkbox-inline class if you want the checkboxes to appear on the same line:

<label class="checkbox-inline"><input type="checkbox" value="">Option 1</label>
<label class="checkbox-inline"><input type="checkbox" value="">Option 2</label>
<label class="checkbox-inline"><input type="checkbox" value="">Option 3</label>

Bootstrap Radio Buttons
Radio buttons are used if you want to limit the user to just one selection from a list of preset options.

The following example contains three radio buttons. The last option is disabled:

<div class="radio">
<label><input type="radio" name="optradio">Option 1</label>
</div>
<div class="radio">
<label><input type="radio" name="optradio">Option 2</label>
</div>
<div class="radio disabled">
<label><input type="radio" name="optradio" disabled>Option 3</label>
</div>

Use the .radio-inline class if you want the radio buttons to appear on the same line:

<label class="radio-inline"><input type="radio" name="optradio">Option 1</label>
<label class="radio-inline"><input type="radio" name="optradio">Option 2</label>
<label class="radio-inline"><input type="radio" name="optradio">Option 3</label>

Bootstrap Select List
Select lists are used if you want to allow the user to pick from multiple options.

The following example contains a dropdown list (select list):

<div class="form-group">
<label for="sel1">Select list:</label>
<select class="form-control" id="sel1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</div>
Read more
Resolved: PHP datetime to russian user friendly format converting. Дата и время на русский на дружественный вид
posted by admin on October 12, 2016
I have datetime from databse MySQL, in format
2016-10-10 12:34:33

By PHP datetime formats I can have string like this
07 October 2016, 04:11, Friday

But I want the3 same output, but in russian
07 Октября 2016, 04:11, ПятницаRead more
Resolved: Yii 1: Uncaught TypeError: jQuery(...).yiiactiveform is not a function
posted by admin on October 10, 2016
In form pages I have got an error like this

Yii 1: Uncaught TypeError: jQuery(...).yiiactiveform is not a function

Form:

<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
...
<?php $this->endWidget(); ?>

head:

...
<?php Yii::app()->clientScript->registerScriptFile(app::baseUrl(false, "/js/", "jquery-1.9.1.min.js"), CClientScript::POS_HEAD);?>
...

Warning:
app::baseUrl(false, "/js/", "jquery-1.9.1.min.js") - it is my function and class, repace it by Yii baseURL propertyRead more
Wiki: PHP strtotime() Functionwiki
posted by admin on May 22, 2016
Example
Parse English textual datetimes into Unix timestamps:

<?php
echo(strtotime("now") . "
");
echo(strtotime("3 October 2005") . "
");
echo(strtotime("+5 hours") . "
");
echo(strtotime("+1 week") . "
");
echo(strtotime("+1 week 3 days 7 hours 5 seconds") . "
");
echo(strtotime("next Monday") . "
");
echo(strtotime("last Sunday"));
?>

Definition and Usage
The strtotime() function parses an English textual datetime into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 GMT).

Note: If the year is specified in a two-digit format, values between 0-69 are mapped to 2000-2069 and values between 70-100 are mapped to 1970-2000.

Note: Be aware of dates in the m/d/y or d-m-y formats; if the separator is a slash (/), then the American m/d/y is assumed. If the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed. To avoid potential errors, you should YYYY-MM-DD dates or date_create_from_format() when possible.

Syntax

strtotime(time,now);


Parameter Description
time Required. Specifies a date/time string
now Optional. Specifies the timestamp used as a base for the calculation of relative dates

Technical Details
Return Value: Returns a timestamp on success. FALSE on failure
PHP Version: 4+
Changelog: PHP 5.3.0: Now relative time formats such as this week, previous week, last week, and next week interprets a week period of Monday through Sunday, rather then a 7-day period relative to the current date/time
PHP 5.3.0: Now 24:00 is a valid format
PHP 5.2.7: In earlier versions, if requesting a given occurrence of a given weekday in a month where that weekday was the first day of the month it would incorrectly add one week to the returned timestamp. This has been corrected now
PHP 5.1.0: Returns FALSE on failure (earlier versions returns -1), and issues E_STRICT and E_NOTICE time zone errors
PHP 5.0.2: Now correctly computes "now" and other relative times from current time, not from today's midnight
PHP 5.0.0: Allows microseconds (but they are ignored)Read more
Resolved: Submit form on change of dropdown list
posted by admin on April 26, 2016
I have SELECT dropdown list

<form method="GET" >
<select id="id_period" name="period">
<option value="day">day</option>
<option value="week">week</option>
<option value="month">month</option>
<option value="all" selected="selected">all time</option>
</select>
</form>

I want to submit form on changeRead more
Resolved: Yii file save error Directory must be writable
posted by admin on April 11, 2016
I have form, and I create directory by mkdir

mkdir($mydirectory, 0777, true);


And got an error during save my file, which I try to upload from my _form.php

Directory must be writable
Read more