-
Notifications
You must be signed in to change notification settings - Fork 137
How to add multi-value field? #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@hondaman900, thanks for submitting this issue.
This will generate (CRUD) for your new entity and generate user drop-down in Please check the following link scaffold-interface OneToMany. |
Thanks for the quick response. That's not exactly what I was trying to achieve. I was hoping that the generated data entry form could provide my user with a drop-down list of options for some fields, rather than having them type in entries that need to be one from a pre-determined set of values. For instance, for a user entering their address they should be able to select a drop-down list of states to enter their state, rather then type in the state letters. It's a limited preset list and this avoids typo errors. I was hoping that in the blades for edit or create that I could simply code in a form element with pre-populated list of options, and have the result of the user's choice be recorded in the database and displayed as a regular field in the index and show blades. |
Update: I did get mostly success implementing a populated drop-down for a form field by replacing the blade form element with a , retaining the existing parameters and populating the options. There are some weird behaviors but I think I can sort them out. I did try to create an entity with a user drop-down as you suggested above and following your documentation, but the "Associate" button created provides the single option to select users but then gives a "page not found" error. Have to dig deeper into that to get it to work. From your comments I thought that the logged-in user could create records that wouldn't be available/visible to a different user. However, switching to a different user shows all records. All users see all records. Isn't isolating content owned by separate users not the default behavior or do I need to set that up somewhere? Thanks again for your support - much appreciated. |
public create()
{
$states = ["1" => "usa", "2" => "uk", "3" => "japan"];
return view('example.create', compact("states"));
}
<form . . . >
....
<div class="form-group">
<label for="state">State</label>
<select name="state" id="state">
@foreach($states as $key => $value)
<option value="{{$key}}">{{$value}}</option>
@endforeach
</select>
</div>
...
</form>
public function store(Request $request)
{
$user = \App\User::findorfail(Auth::user()->id);
$user->state = $request->state;
return redirect('example');
} I hope this will answer your issue!! |
@hondaman900 Hi again!! scaffold-interface uses the great laravel/spatie-permession package that makes you eligible to give permissions to your users to display some contents to them etc... |
Hi, this is a nice package but I think that the developers have stopped working on it. Maybe you can try this package: https://github.com/Muhammadinaam/speed-admin. It supports Laravel 8+. |
I'm trying to make one of the user input form fields a drop-down options list. I can do this (add the HTML for the ) in the blade and have tried to have this modify the database data, to no avail. Can you recommend how to do this. I want to use this tool to accelerate a project that has many data input forms for the user, but need to be able to have the user select from drop-down options for some fields. Thanks in advance for your help.
The text was updated successfully, but these errors were encountered: