I am junior developer and got stucked with such problem: Laravel brings me back an error: "Use of undefined constant input - assumed 'input'" And I dont understand why: this variable is IN javascript code.
Here it is:
<div class="form-group">
{!! Form::label('pac-input', 'Адрес') !!}
{!! Form::text('pac-input', $meta ? $meta->pac-input:old('pac-input', null), ['class' => 'form-control', 'placeholder' => 'Введите адрес']) !!}
</div>
My input
var input = (
document.getElementById('pac-input'));
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
My JavaScript code (google.maps.api3)
Also got a question: in the source there was a comment after
var input = /** @type {!HTMLInputElement} */(
document.getElementById('pac-input'));
What kind of HTMLInputElement
this one wants?
Thanks!
You have a typo in your code.
Replace
$meta->pac-input
with
$meta->pac->input
The culprit here is -
Laravel blade templating sees your variable $meta->pac-input
as $meta->pac
and -input
instead of $meta->pac-input
as a single variable.
So you might want to change you code into,
<div class="form-group">
{!! Form::label('pac_input', 'Адрес') !!}
{!! Form::text('pac_input', $meta ? $meta->pac_input:old('pac_input', null), ['class' => 'form-control', 'id' => 'pac_input' 'placeholder' => 'Введите адрес']) !!}
</div>