
ngrmm
Members-
Posts
474 -
Joined
-
Last visited
-
Days Won
3
ngrmm's Achievements
-
UPDATE: I think I found a solution. You have to remove the InputfieldStateChanged class from the field wrapper after your AJAX changes. function resetFieldState(fieldId) { const wrap = document.querySelector(`#wrap_${fieldId}`); if (wrap?.classList.contains('InputfieldStateChanged')) { wrap.classList.remove('InputfieldStateChanged'); } } // then use resetFieldState('Inputfield_your_fieldname') after your ajax code
-
I’m working on a custom runtime markup field in ProcessWire’s admin. This field loads DOM elements asynchronously after the page loads (via JavaScript), updating part of the form visually. The problem: When I try to leave the page without actually changing any form inputs, the "There are unsaved changes, are you sure you want to leave?" prompt still appears. I suspect ProcessWire's admin JavaScript is detecting these DOM changes, but I’m unable to find which JS object or event is responsible. Can anyone share how ProcessWire’s admin detects changes or how to override/reset that state? Or pointers on what JS objects or events to manipulate? Thanks a lot in advance!x
-
I need a simple htpasswd protection for my website
ngrmm replied to tires's topic in General Support
@tires I can't help you with the htaccess But you could just use ProtectedMode https://processwire.com/modules/protected-mode/ -
@kaz beware // hreflang="english" is not valid // it should be hreflang="en" <link rel="alternate" hreflang="en" href="https://domain.local:8890/en/services/" />
-
this is how I did it // Output a default alternate link for search engines that don't support hreflang echo "<link rel='alternate' hreflang='x-default' href='$page->httpUrl' />"; // Loop through all available languages foreach($languages as $language) { if(!$page->viewable($language)) continue; $url = $page->localHttpUrl($language); $hreflang = $language->name; // Replace "default" with "de" (assumes "de" is the default language) $hreflang = ($hreflang == 'default') ? "de" : $hreflang; // Output the alternate link for the current language echo "<link rel='alternate' hreflang='$hreflang' href='$url' />"; }
-
I meant something else. You're using FormBuilder, which offers four different options (A, B, C, and D) to embed your form into a template or page. For example, if you use option D, you're implementing custom code, and the rendering is not handled by FormBuilder. In that case, the hook would have no effect.
- 4 replies
-
- 1
-
-
- formbuider
- hidden input
-
(and 1 more)
Tagged with:
-
which embed type are you using?
- 4 replies
-
- formbuider
- hidden input
-
(and 1 more)
Tagged with:
-
@bernhard that was it, thanks a lot!
-
ngrmm started following How to refresh page tree after a hook
-
Page is moved after being unpublished via a hook. If you do on the page directly (settings tab) you have to click on the save button. This trigger a reload and everything is fine. But if you unpublish a page via the action button in the page tree view, there is no forced reload. Is there a way to force a refresh of the page tree via JS? $wire->addHookBefore('Pages::save', function($event) { $p = $event->arguments(0); if($p->template == 'funding_item') { // Disable output formatting $p->of(false); $newParent = wire('pages')->get(1234); $p->parent = $newParent; $p->save(); } }); UPDATE: I'm forcing it this way right now. But there should be a way to do it via AJAX as PW page tree is working on default. // config.php $config->scripts->add($config->urls->templates . "/scripts/_admin/pagetree_move.js"); // pagetree_move.js document.addEventListener("DOMContentLoaded", function() { const observer = new MutationObserver((mutationsList, observer) => { const unpublishButtons = document.querySelectorAll('.PageListTemplate_template_name a.PageListActionUnpublish'); unpublishButtons.forEach((btn) => { if (!btn.dataset.listenerAttached) { btn.dataset.listenerAttached = "true"; btn.addEventListener('click', function () { console.log('Unpublish clicked'); setTimeout(() => { location.reload(); }, 1000); }); } }); }); observer.observe(document.body, { childList: true, subtree: true, attributes: true }); });
-
-
@kuba go to the Languages Support - Page Names module and scroll down to the section Behavior when page not available in requested language (but is available in default language)
-
@Roope It seems that it does not work with Chinese characters inside an <a> tag. <a href="mailto:mail@website.com"><span>发送电子邮件</span></a> // error console page/:254 Uncaught URIError: URI malformed at decodeURIComponent (<anonymous>) at emo.decrypt (page/:254:558) at emo.replace (page/:254:382) at emo.init (page/:254:105)
-
make sure, that the client or someone else does not overwrite the page with an empty one. You never know what clients do! Maybe he has a browser tab open (page with empty fields) from long time ago before you wrote the text and just clicked save. If this happens regularly, you could try to use version control for debug
-
@Ana this is related to Frontend. Proceswire lets you decide how you want things to be on the frontend. So there is no ready to use solution for this. You could write you own JS, it's not much. Or scripts isotope, mixitup or take a look at htmx