string sql = @"SELECT ""ID_TagName"",
""F_ComPort"",
""F_ComPortBaudRate"",
""F_ComQuery"",
""F_ParseFunction"",
""F_TagReadTime"",
""F_AnswerLenght"",
""F_AnswerKey"",
""F_AnswerKeyPosition"",
""F_ComPortIPAdress"",
""F_ComPortParity"",
""F_ComPortDataBits"",
""F_ComPortStopBit"",
""F_ComPortFlowControl"",
""F_ComPortTimeOut""
FROM ""SC_Tag"".""T_TagName"" AS tn,
""SC_Tag"".""T_HardWareTag"" AS hw,
""SC_Tag"".""T_RealHardWare"" AS rh
WHERE rh.""ID_RealHardWare"" = hw.""F_RealHardWare_ID""
AND tn.""F_HardWare_ID"" = hw.""F_TagName_ID""
AND ""F_ComPortIPAdress"" = '127.0.0.1'
AND lower(""F_ServerName"") =lower('" + Name + "')";
<script>
var input = document.getElementById("id[13]");
var ca = document.getElementById("id[11]");
var si = document.getElementById("id[12]");
input.disabled = true;
ca.onblur = function () {
this.value = (this.value.replace(',', "."));
if (isNaN(this.value)) { // введено не число
// показать ошибку
this.className = "error";
error.innerHTML = 'Вы ввели не число. Исправьте, пожалуйста.'
}
else {
if (!isNaN(si.value)) {
input.value = ((parseFloat(ca.value) || 0) / (parseFloat(si.value) || 0)).toFixed(3);
}
}
};
si.onblur = function () {
this.value = (this.value.replace(',', "."));
if (isNaN(this.value)) { // введено не число
// показать ошибку
this.className = "error";
error.innerHTML = 'Вы ввели не число. Исправьте, пожалуйста.'
}
else {
if (!isNaN(ca.value)) {
input.value = ((parseFloat(ca.value) || 0) / (parseFloat(this.value) || 0)).toFixed(3);
}
}
};
si.onfocus = function () {
if (this.className == 'error') { // сбросить состояние "ошибка", если оно есть
this.className = "";
error.innerHTML = "";
}
};
ca.onfocus = function () {
if (this.className == 'error') { // сбросить состояние "ошибка", если оно есть
this.className = "";
error.innerHTML = "";
}
};
</script>
'<_m>/<_c>/<_a>' => '<_m>/<_c>/<_a>'
<?php
Yii::app()->clientScript->registerScript('register_script_name', "
$('#editButton').click(function(){
document.getElementById('started').value=''; this.blur(); return false;
});
", CClientScript::POS_READY);
echo CHtml::button('Очистить', array('title' => "Edit", 'id' => "editButton"));
?>
<?php if (empty($master)) echo $form->textArea($model, 'act_end', array('rows' => 6, 'cols' => 50));
Yii::app()->getClientScript()->registerScript('myscript','$("#Engine_act_end").keyup(function() {
document.getElementById(\'Engine_reclaimed\').style.display="block";
});');
?>
<div class="row" >
<?php if (empty($master)) echo $form->labelEx($model, 'reclaimed'); ?>
<?php
if (empty($master))
echo $form->checkBox($model, 'reclaimed', array(
'template' => '{input} {labelTitle}',
'class' => 'chclass',
// 'visible' => 'FALSE',
'onchange' => 'javascript:'
. 'if(this.checked)'
. ' document.getElementById("Engine_recovered").value= new Date().toLocaleDateString() +" "+ new Date().toLocaleTimeString();'
. 'else document.getElementById("Engine_recovered").value="";'
)
);
?>
<?php if (empty($master)) echo $form->error($model, 'reclaimed'); ?>
</div>
<script type='text/javascript'>
document.getElementById('Engine_reclaimed').style.display = 'none';
</script>
<script type="text/javascript" src="/js/bootstrap-datepicker.js"></script>
<input id="date" type="text" name="dat1" class="date" maxlength=50 size=25% />
<script>
$(function () {
$('#date').datepicker({
language: "ru",
selectWeek: true,
format: "dd.mm.yyyy",
autoclose: true,
todayHighlight: true});
var queryDate = "<?php echo "$mn" ?>";
$('#date').datepicker('setDate', queryDate);
$('#date').datepicker()
.on('changeDate', function (ev) {
document.getElementById('newFormAdv').submit();
});
});
</script>
<?php
namespace app\controllers;
use Yii;
use yii\web\Controller;
use app\models\UploadForm;
use yii\web\UploadedFile;
class UploadController extends Controller
{
public function actionIndex()
{
$model = new UploadForm();
if (Yii::$app->request->isPost) {
$model->file = UploadedFile::getInstance($model, 'file');
if ($model->file && $model->validate()) {
$model->file->saveAs('uploads/' . $model->file->baseName . '.' . $model->file->extension);
}
}
return $this->render('index', ['model' => $model]);
}
}