Jump to content

ngrmm

Members
  • Posts

    474
  • Joined

  • Last visited

  • Days Won

    3

ngrmm last won the day on March 21 2024

ngrmm had the most liked content!

Contact Methods

  • Website URL
    https://www.engramm.com

Profile Information

  • Gender
    Not Telling
  • Location
    Germany

Recent Profile Visitors

7,332 profile views

ngrmm's Achievements

Sr. Member

Sr. Member (5/6)

202

Reputation

2

Community Answers

  1. 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
  2. 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
  3. @tires I can't help you with the htaccess But you could just use ProtectedMode https://processwire.com/modules/protected-mode/
  4. @kaz beware // hreflang="english" is not valid // it should be hreflang="en" <link rel="alternate" hreflang="en" href="https://domain.local:8890/en/services/" />
  5. 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' />"; }
  6. I'm not sure if this works via the field in the backend, but you could handle it with a hook. https://processwire.com/api/ref/form-builder-processor/email-form/
  7. 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.
  8. which embed type are you using?
  9. @bernhard that was it, thanks a lot!
  10. 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 }); });
  11. @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)
  12. @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)
  13. 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
  14. @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
×
×
  • Create New...