Click here to Skip to main content
15,944,397 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello ... in update model i want to dispaly country table informations but iam unable to pass the id when pressing on edit button and the Model not show up . button :

HTML
<button type="button" class="btn btn-icon rounded-circle btn-outline-primary"
         data-bs-toggle="modal" data-bs-target="#edit{{ $Country->id }}">
                  
</button>


Modal:

HTML
<div class="modal fade text-start" id="edit{{ $Country->id }}" tabindex="-1" aria-labelledby="myModalLabel33"
            aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel33">{{ trans('countries.editcountry') }}</h4>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <form action="{{ route('Countries.update') }}" method="POST">
                        @csrf
                        <div class="modal-body">
                            <label for="Name_en">{{ trans('countries.countryenglishname') }}</label>
                            <div class="mb-1">
                                <input type="text" name="Name_en" placeholder="Country English Name"
                                    class="form-control" />
                            </div>
                            <label for="Name_ar">{{ trans('countries.countryarabicname') }}</label>
                            <div class="mb-1">
                                <input type="text" name="Name_ar" placeholder="Country Arabic Name"
                                    class="form-control" />
                            </div>
                            <label for="Country_code">{{ trans('countries.countrycode') }}</label>
                            <div class="mb-1">
                                <input type="text" name="Country_code" placeholder="Country Code"
                                    class="form-control" />
                            </div>
                            <label>{{ trans('countries.countrynotes') }}</label>
                            <div class="mb-1">
                                <textarea type="text" name="Country_notes" placeholder="Country Notes" class="form-control"></textarea>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="submit" id="type-success"
                                class="btn btn-primary">{{ trans('countries.save') }}</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>



no error coming even in console

Thanks

What I have tried:

i Tries to dump country before the button to see if it's correct and has id

HTML
@dd($Country)
<button type="button" class="btn btn-icon rounded-circle btn-outline-primary"
         data-bs-toggle="modal" data-bs-target="#edit{{ $Country->id }}">
                  
</button>


and yes its have id

i tried another way

HTML
<div class="modal fade text-start" id="edit{{ $Country->id }}" tabindex="-1" aria-labelledby="myModalLabel33"
            aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel33">{{ trans('countries.editcountry') }}</h4>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <form action="{{ route('Countries.store') }}" method="POST">
                        @csrf
                        <div class="modal-body">
                            <label for="Name_en">{{ trans('countries.countryenglishname') }}</label>
                            <div class="mb-1">
                                <input type="text" name="Name_en" placeholder="Country English Name"
                                    class="form-control" value="{{ $Country->getTranslation('CountryName', 'en') }}" />
                            </div>
                            <label for="Name_ar">{{ trans('countries.countryarabicname') }}</label>
                            <div class="mb-1">
                                <input type="text" name="Name_ar" placeholder="Country Arabic Name"
                                    class="form-control" value="{{ $Country->getTranslation('CountryName', 'ar') }}" />
                            </div>
                            <label for="Country_code">{{ trans('countries.countrycode') }}</label>
                            <div class="mb-1">
                                <input type="text" name="Country_code" placeholder="Country Code"
                                    class="form-control" />
                                {{ $Country->CountryNumCode }}
                            </div>
                            <label>{{ trans('countries.countrynotes') }}</label>
                            <div class="mb-1">
                                <textarea type="text" name="Country_notes" placeholder="Country Notes" class="form-control">{{ $Country->CountryNotes }}</textarea>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="submit" id="type-success"
                                class="btn btn-primary">{{ trans('countries.save') }}</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
Posted
Updated 21-Aug-22 4:42am
Comments
khalid4775 21-Aug-22 10:42am    
now iam getting this error in console

vendors.min.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'classList')
at Nt._isAnimated (vendors.min.js:2:161622)
at Nt._initializeBackDrop (vendors.min.js:2:159691)
at new Nt (vendors.min.js:2:158142)
at Nt.getOrCreateInstance (vendors.min.js:2:114697)
at HTMLButtonElement.<anonymous> (vendors.min.js:2:162919)
at HTMLDocument.i (vendors.min.js:2:112370)
_isAnimated @ vendors.min.js:2
_initializeBackDrop @ vendors.min.js:2
Nt @ vendors.min.js:2
getOrCreateInstance @ vendors.min.js:2
(anonymous) @ vendors.min.js:2
i @ vendors.min.js:2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900