Sounds like you're talking about a chained select. You could try this plugin:
Feb 4, 2017
3
Level 1
Cascading Dropdown list
Hello, i have 2 tables one called "proveedores" and another one called "clientes"; both tables have the same field called "nombre". I want to populate the second dropdown list with all the ítem on the field "nombre" of the database that the user choose on the first dropdownlist, can you help me, cause i'm new at this and i know that i have to use a java script or something like it. thanks in advance.
Here is what i have on the form.blade.php
<div class="form-group">
{!! Form::label('tipo_empresa','Tipo de Empresa: ') !!}
{!! Form::select('tipo_empresa',
array('Cliente' => 'Cliente', 'Proveedor' => 'Proveedor'),
null,
['class'=>'form-control']
) !!}
</div>
<div class="form-group">
{!! Form::label('nombre','Nombre de la empresa: ') !!}
{!! Form::text('nombre',null,['class'=>'form-control']) !!}
</div>
Here is create.blade.php
@extends ('layouts/app')
@section('content')
<h1>Ingrese el nuevo Contacto</h1>
<hr/>
{!! Form::open(['url' => 'contactos']) !!}
@include('contactos.form',['submitButtonText' => 'Añadir Contacto'])
{!! Form::close() !!}
@include('errors/list')
@stop
here is the controller
public function create()
{
return view('contactos.create');
}
public function store(contactorequest $request)
{
contacto::create([
'user_id'=> Auth::user()->id,
'tipo_empresa'=> request('tipo_empresa'),
'empresa_id'=> request('empresa_id'),
'nombre'=> request('nombre'),
'sector'=> request('secotr'),
'telefono'=> request('telefono'),
'interno'=> request('interno'),
'mail'=> request('mail'),
'celular'=> request('celular'),
'localidad'=> request('localidad'),
'observaciones'=> request('observaciones'),
]);
session()->flash('message','Contactos creado exitosamene');
return redirect('contactos');
}
Level 20
1 like
Please or to participate in this conversation.