I have a hidden input field in view in the ActiveForm
<?php $form = ActiveForm::begin(); ?>
<input type="file" id="i_file" name="uploadfile" value="" onchange="abc()">
<?= $form->field($model, 'path')->hiddenInput() ?>
<div class="form-group">
<?= Html::submitButton('submit', ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
I am setting it's value using Javascript as shown below:
<script>
function abc(){
var tmppath = URL.createObjectURL(event.target.files[0]);
$("#taskreports-path").val(tmppath);
alert(document.getElementById("taskreports-path").value);
}
</script>
Alert shows that the value is set into the field successfully. Now I want the value of that input field in some php variable like:
$var path = //<?= $form->field($model, 'path')->hiddenInput() ?> this field's value
How can I do that in Yii2?