Closed anthonymanzo closed 5 years ago
Hi, This was my workaround. It looks like 'auto_' is prepended to the name of the autocomplete element. So, I ended up doing this in att the bottom of my blade file:
@push('scripts')
{!! Rapyd::scripts() !!}
<script type="text/javascript">
$(document).ready(function () {
//Prefill the entire form if an entry is found and selected.
$('#auto_vendor_name').on('typeahead:selected', function (e, datum) {
console.log(datum);
if(typeof datum.email_address != "undefined"){
$("#email_address").val(datum.email_address);
} else {
$("#email_address").val('');
}
if(typeof datum.contact_name != "undefined"){
$("#contact_name").val(datum.contact_name);
} else {
$("#contact_name").val('');
}
if(typeof datum.full_address != "undefined"){
$("#full_address").val(datum.full_address);
} else {
$("#full_address").val('');
}
if(typeof datum.phone_number != "undefined"){
$("#phone_number").val(datum.phone_number);
} else {
$("#phone_number").val('');
}
});
});
</script>
@endpush
I'm closing the ticket.
Hi, How can I get all the data from the response so I can auto-fill the rest of my form when a change event occurs on the below 'vendor_name' field?
Here's here's how my element looks ( as part of a DataEdit object):
And here's my method that responds to the remote route, it returns all the other fields I need besides just the vendor name:
Thanks!