Add debugging and fix form field attributes in admin modal
- Add console logging to openEditModal function to debug AJAX load - Add explicit id and name attributes to admin select field - Only show modal after content successfully loads - Log errors if modal content fails to load This helps diagnose the modal loading issue and fixes the Chrome warning about form fields lacking id/name attributes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -51,9 +51,17 @@
|
|||||||
|
|
||||||
function openEditModal(id){
|
function openEditModal(id){
|
||||||
var link = '/admin/'+ id +'/get_user';
|
var link = '/admin/'+ id +'/get_user';
|
||||||
$("#editAcct .modal-content").load(link);
|
console.log('Loading modal content from:', link);
|
||||||
|
|
||||||
|
$("#editAcct .modal-content").load(link, function(response, status, xhr) {
|
||||||
|
console.log('Load status:', status);
|
||||||
|
if (status == "success") {
|
||||||
var modal = new bootstrap.Modal(document.getElementById('editAcct'));
|
var modal = new bootstrap.Modal(document.getElementById('editAcct'));
|
||||||
modal.show();
|
modal.show();
|
||||||
|
} else {
|
||||||
|
console.error('Failed to load modal content:', xhr.statusText);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function dataTablePagination(){
|
function dataTablePagination(){
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<%= f.label :admin, nil, {:class => "form-label"}%>
|
<%= f.label :admin, nil, {:class => "form-label"}%>
|
||||||
<%= f.select(:admin, @admin_select, {}, {:class => "form-select"}) %>
|
<%= f.select(:admin, @admin_select, {}, {:class => "form-select", :id => "user_admin", :name => "user[admin]"}) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
Reference in New Issue
Block a user