Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?=
- $form->field($check, 'brightnessLevel')
- ->label('Яркость')
- ->input('range', [
- 'id' => 'brightness',
- 'value' => 0,
- 'min' => -100,
- 'max' => 100
- ])
- ?>
- function setDefaultValue() {
- var xhmlhr = new XMLHttpRequest();
- xhmlhr.withCredentials = true;
- xhmlhr.open('GET', '/url/url');
- xhmlhr.send();
- xhmlhr.onreadystatechange = function() {
- if (this.readyState === 4 && this.status === 200)
- defalutVal = xhmlhr.responseText;
- brightness.setAttribute('disabled', true);
- brightness.value = defalutVal;
- changeBrightness();
- }
- }
- public function actionUpdate($id)
- {
- $check = new EditingImage();
- $model = $this->findModel($id);
- if ($check->load(Yii::$app->request->post())) {
- // if ($model->save()){
- // }
- // здесь значение теряется (если не таскать сам ползунок, а именно через js пытаться устанавливать)
- $check->status = $check::STATUS_ON;
- $check->dir = Images::IMAGES_DIR;
- $check->url = $model->url;
- if ($check->increaseBrightness())
- return $this->redirect(['view', 'id' => $model->id]);
- }
- return $this->render('update', [
- 'model' => $model,
- 'check' => $check,
- ]);
- }
- console.log('defalutVal: ' + defalutVal);
- console.log('brightnessVal: ' + brightness.value);
- brightness.value = defalutVal;
- console.log('brightness.value = defalutVal (' + brightness.value + ')');
- brightness.setAttribute('disabled', true);
Add Comment
Please, Sign In to add comment