I have restored the site using a previous backup which means the problem was with either the database or the website files. I suspect the DB. The only explanation I can think of is that the backup I was using, which gave the problems but previously installed fine, somehow got corrupted. But how do you corrupt a zipped file by accident? If nothing else it teaches me to test restore backups more often! Luckily the previous backup worked, leaving only a few items to re-post.
What you said about php versions (which were the same for both servers - 8.3.13) made me realise that the MariaDB versions were different. The backup was done with 10.5.x whereas the restore server was running 10.3.x. So I moved back to the original server using the same site (drupal core + sites folder) and database backup. And when I set the php version to 8.3.13 I see the website with no error messages.
Brilliant! But unfortunately there's no CSS formatting. And the frontpage logo doesn't display. Here's a link .
The sites .htaccess and settings.php have not been altered as the DB has been built with the same name and credentials.
I've had this problem before which I think was solved by clearing cache. But I've done this in phpMyAdmin, to no effect.
Looking at the page source shows no css files are loaded. All the website pages seem correctly displayed below the unformatted navigation. But when I try and login to access the admin pages, I get an access denied.
The site has the Solo theme. Could this be the problem - should I delete the theme files and replace them?
What's a puzzle is that when I restored these exact same files 2 weeks ago onto the same server, there were no problems. And restores of two other sites (D10.2.5 , php 8.3.13, MariaDB 10.3.39) on a new server with a different Unix OS worked without issue. The only difference is the problem site is a lot larger - DB size around 130MB.
It seems I'm almost there to getting the website back but I'm stumped on what to try next. Should I try and re-install/upgrade Drupal core? I'm not sure what the version and I can't check because I'm unable to access the admin interface. It's not the latest version - probably 10.2.5
Thanks for any further help you can give on this.
I'll look more closely at this API and see how my coding skills match what's required. Thanks for this pointer.
I wanted some data to play with in D11 but as migration is going to be required down the line, maybe I should start familiaring myself with this right now.
... for links to these two modules. And for helping me realise that all that is required is the addition of target = "blank" to the a tag. If I have a text format without an editor and no tag stripping, I can just edit the url.
So if I have a /working sub-directory, <a href="/working/node/add/page" target="blank">Add Page</a> opens a new tab to create a page. And I can do this in views with a Rewrite Results facility. Brilliant! And with the module Editor Advanced Link I can do this within CKEditor.
Thanks VM for solving this so quickly!
Sorry, I don't know why I didn't say thanks 2 years ago. Yes, it putting libraries folder in webroot works! Thanks and apologies again.
Here are the reasons why pop-up's sometimes seemed to work first time, sometimes after a time lapse and sometimes not at all. All down to me and my carelessness.
- Failing to specify the url absolutely correctly. Sloppy url's seem to upset Ajax whereas the form will display in a new page. My typo's were forgetting the // and, perhaps, using http after I'd attached an encryption certificate to the domain. So if it's a secured site, Ajax seems to want https://
- Using nid in the url when the correct field name is id. I.e ?id={{id}}. Again it seems that using nid will get the form displayed but not as a pop-up.
- Using "use-ajax" data-dialog-type="modal" but forgetting to change the text format to Full HTML when entering the source code.
- In the panic and confusion, leaving out "use-ajax" altogether!!
So apologies to Drupal! "use-ajax" data-dialog-type="modal" works faultlessly provided you code correctly!
I created another site. D911, default theme and added all the same modules (custom form, view custom table, backup migrate, views auto refresh). Views cache turned off. Use Ajax left at No. And both add and amend pop-up!
So... problem solved in one way. I replicated what worked first-off a month ago. But, I've no idea why the other sites failed/continue to fail. All sites are in same domain and on the same server. Returning to the last test site, amend still fails to pop-up.
Vanilla D9.1 site with just the modules needed to replicate previous tests. And neither add or amend displays in a pop-up. I commented earlier that with the last site, initially add record did not show in a pop-up. Then, for no apparent reason, pop-up's started working. Looks like the same with this latest test site.
What can cause this? Very strange. It supports my view that originally I had both add and amend forms in pop-ups.
Here are my responses to the troubleshooting points you raised.
1/2 The View relates to a custom table. You raise a good point, the table does not have an nid field! But it works, strangely. I've changed the query string to ?id={{id}} but the edit form still does not show as a pop-up, just a normal page. (BTW - Correction to my last post - The Add Record button in the Views header section does show as a pop-up.)
3. The user is the site administrator. User 1. The edit form works.
4. The view was not set to use Ajax so I've changed it, cleared cache but the edit form still doesn't pop-up. Shame, I thought this might correct the problem.
5. I've added the preprocess code you provided. Into the .MODULE file. Replaced 'my_module' with the real module name and 'my_view' with the view name. I also used the Views attach library module adding core/drupal.dialog.ajax in the View parameters. I've now realised that most of the scripts load at the bottom of the page (and JQuery is present!) But searching for core/drupal.dialog.ajax returns nothing. Have I done something wrong? I've included the script loading part of the page source at the end of this post.
[In case its relevant, I've turned off caching on the view so the results of an amendment are visible immediately the user returns to the view. And a D10.1 site exhibits the same problem.]
Thanks so much for your help with this. It's made me do some more thinking...
- The fact that a link to add a new record does now work in the View means that the problem isn't with Views. Because the edit url included in an article and in a block also fail to display as a pop-up. So, Ajax must be working in the view for the add form to work.
- Could it be that the problem relates to the database query included in the edit form, but not in the add? The add form just has to render a static form structure. The edit has to wait for the database to return the data before it can load the form. Does this upset the 'use-ajax' code?
- I'm still struggling with the belief that a month or so ago, I believe I got an edit form in a pop-up. Could I have been mistaken and only tested the Add? I don't think so. Problem is the test site isn't there anymore.
Thanks for reading all this. If you have any further ideas or tests, please let me know.
Here is the code for both the add and edit form in case you might spot something to explain why the edit form fails to show in a pop-up.
Edit Form
<?php
namespace Drupal\dn_students\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Database\Database;
use Drupal\Core\Url;
use Drupal\Core\Routing;
/**
* Provides the form for adding countries.
*/
class StudentEditForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'dn_student_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$page = \Drupal::request()->getRequestUri();
$page = explode("=", $page);
$messenger = \Drupal::messenger();
$messenger->addStatus($page[1]);
try {
$testid = $page[1];
$database = \Drupal::database();
$sql = "SELECT id,fname,sname,age,marks FROM {students} WHERE id = :vid";
$result = $database->query($sql, [':vid' => $testid]);
foreach ($result as $record) {
$id = $record->id;
$fname = $record->fname;
$sname = $record->sname;
$age = $record->age;
$marks = $record->marks;
}
$form['id'] = [
'#type' => 'textfield',
'#title' => $this->t('Student ID'),
'#required' => FALSE,
'#maxlength' => 20,
'#default_value' => $id,
];
$form['fname'] = [
'#type' => 'textfield',
'#title' => $this->t('First Name'),
'#required' => TRUE,
'#maxlength' => 20,
'#default_value' => $fname,
];
$form['sname'] = [
'#type' => 'textfield',
'#title' => $this->t('Second Name'),
'#required' => TRUE,
'#maxlength' => 20,
'#default_value' => $sname,
];
$form['age'] = [
'#type' => 'textfield',
'#title' => $this->t('Age'),
'#required' => TRUE,
'#maxlength' => 20,
'#default_value' => $age,
];
$form['marks'] = [
'#type' => 'textfield',
'#title' => $this->t('Marks'),
'#required' => TRUE,
'#maxlength' => 20,
'#default_value' => $marks,
];
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = [
'#type' => 'submit',
'#button_type' => 'primary',
'#default_value' => $this->t('Save') ,
];
return $form;
} catch(Exception $ex){
\Drupal::logger('dn_students')->error($ex->getMessage());
}
$taxo_shorcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => 'Test',
'link' => [
'uri' => 'internal:/admin/structure/taxonomy',
],
]);
$taxo_shorcut->save();
}
/**
* {@inheritdoc}
*/
public function submitForm(array & $form, FormStateInterface $form_state) {
try{
$database = \Drupal::database();
$field = $form_state->getValues();
$result = $database->update('students')
->fields([
'sname' => $field['sname'],
'fname' => $field['fname'],
'age' => $field['age'],
'marks' => $field['marks'],
])
->condition('id', $field['id'])
->execute();
$form_state->setRedirect('view.student_list.page_1');
} catch(Exception $ex){
\Drupal::logger('dn_students')->error($ex->getMessage());
}
}
}
Add Form
<?php
namespace Drupal\dn_students\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Database\Database;
use Drupal\Core\Url;
use Drupal\Core\Routing;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* Provides the form for adding countries.
*/
class StudentForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'dn_student_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['fname'] = [
'#type' => 'textfield',
'#title' => $this->t('First Name'),
'#required' => TRUE,
'#maxlength' => 20,
'#default_value' => '',
];
$form['sname'] = [
'#type' => 'textfield',
'#title' => $this->t('Second Name'),
'#required' => TRUE,
'#maxlength' => 20,
'#default_value' => '',
];
$form['age'] = [
'#type' => 'textfield',
'#title' => $this->t('Age'),
'#required' => TRUE,
'#maxlength' => 20,
'#default_value' => '',
];
$form['marks'] = [
'#type' => 'textfield',
'#title' => $this->t('Marks'),
'#required' => TRUE,
'#maxlength' => 20,
'#default_value' => '',
];
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = [
'#type' => 'submit',
'#button_type' => 'primary',
'#default_value' => $this->t('Save') ,
];
//$form['#validate'][] = 'studentFormValidate';
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array & $form, FormStateInterface $form_state) {
$field = $form_state->getValues();
$fields["fname"] = $field['fname'];
if (!$form_state->getValue('fname') || empty($form_state->getValue('fname'))) {
$form_state->setErrorByName('fname', $this->t('Provide First Name'));
}
}
/**
* {@inheritdoc}
*/
public function submitForm(array & $form, FormStateInterface $form_state)
{
try{
$conn = Database::getConnection();
$field = $form_state->getValues();
$fields["fname"] = $field['fname'];
$fields["sname"] = $field['sname'];
$fields["age"] = $field['age'];
$fields["marks"] = $field['marks'];
$conn->insert('students')
->fields($fields)->execute();
\Drupal::messenger()->addMessage($this->t('The Student data has been succesfully saved'));
//$form_state->setRedirect('view.students1.page_1');
return new RedirectResponse('students/add');
} catch(Exception $ex){
\Drupal::logger('dn_students')->error($ex->getMessage());
}
}
}
Page Source for the View <script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/dev9511d\/","scriptPath":null,"pathPrefix":"","currentPath":"student-list","currentPathIsAdmin":false,"isFront":false,"currentLanguage":"en"},"pluralDelimiter":"\u0003","suppressDeprecationErrors":true,"ajaxPageState":{"libraries":"big_pipe\/big_pipe,contextual\/drupal.contextual-links,contextual\/drupal.contextual-toolbar,core\/drupal.active-link,core\/drupal.dialog.ajax,olivero\/feed,olivero\/global-styling,olivero\/navigation-primary,olivero\/navigation-secondary,olivero\/powered-by-block,olivero\/search-narrow,olivero\/search-wide,olivero\/sidebar,shortcut\/drupal.shortcut,system\/base,toolbar\/toolbar,toolbar\/toolbar.escapeAdmin,tour\/tour,user\/drupal.user.icons,views\/views.ajax,views\/views.module","theme":"olivero","theme_token":null},"ajaxTrustedUrl":{"\/dev9511d\/search\/node":true},"bigPipePlaceholderIds":{"callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages\u0026args%5B0%5D\u0026token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA":true,"callback=user.toolbar_link_builder%3ArenderToolbarLinks\u0026\u0026token=xssKdKFVFD7N0FUPPcC1C7LrqMHpQFVzUhrI4cOeEgs":true,"callback=user.toolbar_link_builder%3ArenderDisplayName\u0026\u0026token=-MH2NzEnTzbzMk0ZGfGgoiw7G3j_-Q1ILWBRVhIOKLI":true,"callback=shortcut.lazy_builders%3AlazyLinks\u0026\u0026token=N1997Wch59v-LxHku3-dD44wjkSNmhegNzlZ8jS0L5I":true},"views":{"ajax_path":"\/dev9511d\/views\/ajax","ajaxViews":{"views_dom_id:2778ec6be77657ecfb004953918d433d11c14d4254620a80f6d93f553a07a11b":{"view_name":"student_list","view_display_id":"page_1","view_args":"","view_path":"\/student-list","view_base_path":"student-list","view_dom_id":"2778ec6be77657ecfb004953918d433d11c14d4254620a80f6d93f553a07a11b","pager_element":0}}},"toolbar":{"breakpoints":{"toolbar.narrow":"only screen and (min-width: 16.5em)","toolbar.standard":"only screen and (min-width: 38.125em)","toolbar.wide":"only screen and (min-width: 61em)"},"subtreesHash":"W6DxhUlDldeHvSWiuc-mZE9RwrhcJbVhjK4rzaWu9Ns"},"user":{"uid":"1","permissionsHash":"8458bd3056a6b06d68bc7f758af66d0ebe159f568b8c1f489379eef398c57032"}}</script> <script src="/dev9511d/core/assets/vendor/jquery/jquery.min.js?v=3.6.3"></script> <script src="/dev9511d/core/misc/polyfills/nodelist.foreach.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/polyfills/element.matches.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/polyfills/object.assign.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/css-escape/css.escape.js?v=1.5.1"></script> <script src="/dev9511d/core/assets/vendor/es6-promise/es6-promise.auto.min.js?v=4.2.8"></script> <script src="/dev9511d/core/assets/vendor/underscore/underscore-min.js?v=1.13.6"></script> <script src="/dev9511d/core/misc/polyfills/element.closest.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/once/once.min.js?v=1.0.1"></script> <script src="/dev9511d/core/assets/vendor/jquery-once/jquery.once.min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/backbone/backbone-min.js?v=1.4.1"></script> <script src="/dev9511d/core/misc/drupalSettingsLoader.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/drupal.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/drupal.init.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/version-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/data-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/disable-selection-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/form-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/jquery-patch-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/scroll-parent-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/unique-id-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/focusable-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/ie-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/keycode-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/plugin-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/safe-active-element-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/safe-blur-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/widget-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/widgets/controlgroup-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/form-reset-mixin-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/labels-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/widgets/mouse-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/widgets/checkboxradio-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/widgets/draggable-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/widgets/resizable-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/widgets/button-min.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery.ui/ui/widgets/dialog-min.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/contextual.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/models/StateModel.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/views/AuralView.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/views/KeyboardView.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/views/RegionView.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/views/VisualView.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/tabbable/index.umd.min.js?v=5.3.3"></script> <script src="/dev9511d/core/misc/progress.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/jquery.once.bc.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/loadjs/loadjs.min.js?v=4.2.0"></script> <script src="/dev9511d/core/misc/ajax.js?v=9.5.11"></script> <script src="/dev9511d/core/themes/olivero/js/checkbox.js?v=9.5.11"></script> <script src="/dev9511d/core/themes/olivero/js/navigation-utils.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/active-link.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/debounce.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/displace.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/jquery.tabbable.shim.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/position.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/dialog/dialog.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/dialog/dialog.position.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/dialog/dialog.jquery-ui.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/ckeditor5/js/ckeditor5.dialog.fix.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/dialog/dialog.ajax.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/jquery-form/jquery.form.min.js?v=4.3.0"></script> <script src="/dev9511d/core/modules/views/js/base.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/views/js/ajax_view.js?v=9.5.11"></script> <script src="/dev9511d/core/themes/olivero/js/search.js?v=9.5.11"></script> <script src="/dev9511d/core/themes/olivero/js/navigation.js?v=9.5.11"></script> <script src="/dev9511d/core/themes/olivero/js/second-level-navigation.js?v=9.5.11"></script> <script src="/dev9511d/core/themes/olivero/js/nav-resize.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/announce.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/toolbar.menu.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/toolbar.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/models/MenuModel.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/models/ToolbarModel.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/views/BodyVisualView.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/views/MenuVisualView.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/views/ToolbarAuralView.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/views/ToolbarVisualView.js?v=9.5.11"></script> <script src="/dev9511d/core/assets/vendor/shepherd/shepherd.min.js?v=9.1.1"></script> <script src="/dev9511d/core/modules/tour/js/tour.js?v=9.5.11"></script> <script src="/dev9511d/core/misc/tabbingmanager.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/contextual.toolbar.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/toolbar/models/StateModel.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/toolbar/views/AuralView.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/contextual/js/toolbar/views/VisualView.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/toolbar/js/escapeAdmin.js?v=9.5.11"></script> <script src="/dev9511d/core/modules/big_pipe/js/big_pipe.js?v=9.5.11"></script> <script type="application/vnd.drupal-ajax" data-big-pipe-event="start"></script> <script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="callback=shortcut.lazy_builders%3AlazyLinks&&token=N1997Wch59v-LxHku3-dD44wjkSNmhegNzlZ8jS0L5I"> [{"command":"insert","method":"replaceWith","selector":"[data-big-pipe-placeholder-id=\u0022callback=shortcut.lazy_builders%3AlazyLinks\u0026\u0026token=N1997Wch59v-LxHku3-dD44wjkSNmhegNzlZ8jS0L5I\u0022]","data":"\u003Cul class=\u0022toolbar-menu\u0022\u003E\n \u003Cli\u003E\u003Ca href=\u0022\/dev9511d\/node\/add\u0022\u003EAdd content\u003C\/a\u003E\u003C\/li\u003E\n \u003Cli\u003E\u003Ca href=\u0022\/dev9511d\/admin\/content\u0022\u003EAll content\u003C\/a\u003E\u003C\/li\u003E\n \u003C\/ul\u003E\u003Ca href=\u0022\/dev9511d\/admin\/config\/user-interface\/shortcut\/manage\/default\/customize\u0022 class=\u0022edit-shortcuts\u0022\u003EEdit shortcuts\u003C\/a\u003E","settings":null}] </script> <script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="callback=user.toolbar_link_builder%3ArenderDisplayName&&token=-MH2NzEnTzbzMk0ZGfGgoiw7G3j_-Q1ILWBRVhIOKLI"> [{"command":"insert","method":"replaceWith","selector":"[data-big-pipe-placeholder-id=\u0022callback=user.toolbar_link_builder%3ArenderDisplayName\u0026\u0026token=-MH2NzEnTzbzMk0ZGfGgoiw7G3j_-Q1ILWBRVhIOKLI\u0022]","data":"peterkaye","settings":null}] </script> <script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="callback=user.toolbar_link_builder%3ArenderToolbarLinks&&token=xssKdKFVFD7N0FUPPcC1C7LrqMHpQFVzUhrI4cOeEgs"> [{"command":"insert","method":"replaceWith","selector":"[data-big-pipe-placeholder-id=\u0022callback=user.toolbar_link_builder%3ArenderToolbarLinks\u0026\u0026token=xssKdKFVFD7N0FUPPcC1C7LrqMHpQFVzUhrI4cOeEgs\u0022]","data":"\u003Cul class=\u0022toolbar-menu\u0022\u003E\n \u003Cli\u003E\u003Ca href=\u0022\/dev9511d\/user\u0022 title=\u0022User account\u0022\u003EView profile\u003C\/a\u003E\u003C\/li\u003E\n \u003Cli\u003E\u003Ca href=\u0022\/dev9511d\/user\/1\/edit\u0022 title=\u0022Edit user account\u0022\u003EEdit profile\u003C\/a\u003E\u003C\/li\u003E\n \u003Cli\u003E\u003Ca href=\u0022\/dev9511d\/user\/logout\u0022\u003ELog out\u003C\/a\u003E\u003C\/li\u003E\n \u003C\/ul\u003E","settings":null}] </script> <script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages&args%5B0%5D&token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA"> [{"command":"settings","settings":{"ajaxPageState":{"theme":"olivero","libraries":"big_pipe\/big_pipe,contextual\/drupal.contextual-links,contextual\/drupal.contextual-toolbar,core\/drupal.active-link,core\/drupal.dialog.ajax,olivero\/feed,olivero\/global-styling,olivero\/messages,olivero\/navigation-primary,olivero\/navigation-secondary,olivero\/powered-by-block,olivero\/search-narrow,olivero\/search-wide,olivero\/sidebar,shortcut\/drupal.shortcut,system\/base,toolbar\/toolbar,toolbar\/toolbar.escapeAdmin,tour\/tour,user\/drupal.user.icons,views\/views.ajax,views\/views.module"},"pluralDelimiter":"\u0003","user":{"uid":"1","permissionsHash":"8458bd3056a6b06d68bc7f758af66d0ebe159f568b8c1f489379eef398c57032"}},"merge":true},{"command":"add_js","selector":"body","data":[{"src":"\/dev9511d\/sites\/default\/files\/js\/js_nZeya8pJxR8V1nh0_1y7kJIiaR75AedTciQUQKPoKuM.js"}]},{"command":"insert","method":"replaceWith","selector":"[data-big-pipe-placeholder-id=\u0022callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages\u0026args%5B0%5D\u0026token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA\u0022]","data":"\n\n\u003Cdiv data-drupal-messages class=\u0022messages-list\u0022\u003E\n \u003Cdiv class=\u0022messages__wrapper layout-container\u0022\u003E\n \n \u003Cdiv class=\u0022messages-list__item messages messages--status\u0022 data-drupal-selector=\u0022messages\u0022 role=\u0022contentinfo\u0022 aria-label=\u0022Status message\u0022\u003E\n \u003Cdiv class=\u0022messages__container\u0022 data-drupal-selector=\u0022messages-container\u0022\u003E\n \u003Cdiv class=\u0022messages__header\u0022\u003E\n \u003Ch2 class=\u0022visually-hidden\u0022\u003EStatus message\u003C\/h2\u003E\n \u003Cdiv class=\u0022messages__icon\u0022\u003E\n \u003Csvg xmlns=\u0022http:\/\/www.w3.org\/2000\/svg\u0022 width=\u002232px\u0022 height=\u002232px\u0022 viewBox=\u00220 0 32 32\u0022\u003E\n \u003Cpath d=\u0022M26.8,12.6c0,0.4-0.1,0.7-0.4,0.9L15.1,24.9c-0.2,0.2-0.6,0.4-1,0.4c-0.3,0-0.7-0.1-0.9-0.4l-7.5-7.5c-0.2-0.2-0.4-0.6-0.4-0.9c0-0.4,0.1-0.7,0.4-1l1.9-1.9c0.2-0.2,0.6-0.4,0.9-0.4c0.4,0,0.7,0.1,0.9,0.4l4.7,4.7l8.5-8.5c0.2-0.2,0.6-0.4,0.9-0.4c0.4,0,0.7,0.1,0.9,0.4l1.9,1.9C26.6,11.9,26.8,12.3,26.8,12.6z M32,16c0-8.8-7.2-16-16-16C7.2,0,0,7.2,0,16c0,8.8,7.2,16,16,16C24.8,32,32,24.8,32,16z\u0022\/\u003E\n\u003C\/svg\u003E\n \u003C\/div\u003E\n \u003C\/div\u003E\n \u003Cdiv class=\u0022messages__content\u0022\u003E\n Operating in maintenance mode. \u003Ca href=\u0022\/dev9511d\/admin\/config\/development\/maintenance\u0022\u003EGo online.\u003C\/a\u003E\n \u003C\/div\u003E\n \u003C\/div\u003E\n \u003C\/div\u003E\n \u003C\/div\u003E\n\u003C\/div\u003E\n","settings":null}] </script> <script type="application/vnd.drupal-ajax" data-big-pipe-event="stop"></script>
...but
- I was wrong about JQuery. Looking at the page source where I see a modal pop-up, there is no entry for JQuery.
- A brand new D9.11 (no custom modules except View Custom Table) install shows:
- Neither Add or Amend links in the view displays the form as a pop-up
- Adding a new record with the same <a> tag in a block does display the create form in a pop-up. But an edit url in a block does not display as a pop-up.
- Trying to add or edit an article node in a block with the pop-up html does not display as a pop-up.
So I'm still unable to replicate what I achieved on another site - opening an edit link from a View in a custom form. My earlier comment that the problem isn't related to the View obviously isn't correct because adding a new record in a block does display the form as a pop-up, but not when it is a rewritten Views field.
I hope this latest information clears up any confusion in my original post Any further thoughts on displaying data in pop-up forms would be much appreciated.
Yes, disabling FollowSymLinks and reverting to Drupal 7.71 gets the install to work. Brilliant!
With php 8.2, I get another 500 several error lines. I think there is a patch for this. But, not being a great patch practitioner, I think I'll stick with the outdated php version for the short time the D7 site will be around.
Thanks again for the link and for explaining the ip address.
(Actually I had forgotten that I had this problem with D7 and D9 → .)
... for confirming D7/D10 on same server works. I changed the memory to 256MB but still get 500 Server Error. I've posted the error log above. As noted, with php 8.2, D10 installs on this server without issue.
Here are the server log error messages:
[Mon Oct 30 00:47:46.619951 2023] [proxy_fcgi:error] [pid 27626:tid 140211715516160] [client 194.169.175.28:58222] AH01071: Got error 'Primary script unknown'
[Mon Oct 30 01:38:34.688013 2023] [security2:error] [pid 27654:tid 140211639981824] [client 195.128.248.17:58370] [client 195.128.248.17] ModSecurity: Access denied with code 403 (phase 1). Matched phrase "/.git/" at REQUEST_URI. [file "/etc/httpd/conf/modsecurity.d/rules/comodo_free/02_Global_Generic.conf"] [line "117"] [id "210492"] [rev "3"] [severity "CRITICAL"] [tag "CWAF"] [tag "Generic"] [hostname "xxxx.com"] [uri "/.git/config"] [unique_id "ZT8JGg9U-RFPU1C3MyCl-AAAAFg"]
[Mon Oct 30 03:37:25.250787 2023] [ssl:warn] [pid 25341:tid 140212246960256] AH01909: RSA certificate configured for xxxx.com:443 does NOT include an ID which matches the server name
[Mon Oct 30 04:41:07.103022 2023] [proxy_fcgi:error] [pid 27328:tid 140211749086976] [client 194.169.175.28:60226] AH01071: Got error 'Primary script unknown'
[Mon Oct 30 11:19:55.374775 2023] [core:alert] [pid 27328:tid 140211740694272] [client 188.31.210.26:33770] /var/www/vhosts/xxxx.com/httpdocs/devd771/.htaccess: Option FollowSymLinks not allowed here
Is this helpful to point out what's going wrong? I'm puzzled by the ip address 188.31.210.26. This isn't the server ip.
If I change the php version to 8.2, I can install D10 without any issue.
Thanks for any further help on this
... by showing I'm confusiing array variables and object variables. The problem is solved simply by reworking the query result handling code:
$database = \Drupal::database();
$sql = "SELECT fname,sname,age,marks FROM {students} WHERE id = :vid";
$result = $database->query($sql, [':vid' => $testid]);
foreach ($result as $record) {
$id = $record->id;
$fname = $record->fname;
$sname = $record->sname;
$age = $record->age;
$marks = $record->marks;
}
But... this retrieves all the values in the edit form EXCEPT id This field is empty. I've checked the table structure and the field name is correct. Can anyone suggest why this code modification fails to load id?
[In the days of D7 I could use Devel to display page variables but this no longer works in D9/D10. If anyone can point me to the code to insert to see variable values - so I can print to screen $result, that would be super! Thanks.]
I've solved this by picking up the path from the routing.yml file and building the menu myself.
peterk900 → created an issue.
... for the code snippet and for the explanatory links.
Works perfectly! Thanks again.
(Actually the site was D9.5.1 not D10, my mistake!)
I inserted the Symphony use statement at the head of Petform.php, which includes the buildForm, validateForm and submitForm functions and then placed the RedirectReponse code at the end of try block in the submitForm function. I replaced 'zippy' first with the machine name of the view, then with the string Wombatbuddy suggested 'view.Pets1.page_1 and finally with the page name (the url which displays the view). But none of these display the view when the form is submitted. The entry form is re-displayed without any errors.
I should have looked at the Issues before posting. But I thought it must be down to me, couldn't believe it could be a bug in the default theme! Thanks again.