Jump to content

ro-bo

Members
  • Posts

    49
  • Joined

  • Last visited

1 Follower

Contact Methods

  • Website URL
    http://www.weissgrad.at

Profile Information

  • Gender
    Male
  • Location
    Austria

Recent Profile Visitors

2,035 profile views

ro-bo's Achievements

Jr. Member

Jr. Member (3/6)

12

Reputation

  1. Thanks! That's exactly what I'm looking for ?
  2. Hello dear forum members! Is it actually possible to manipulate images that are in the file system and not stored within a field using the PW methods etc. (similar to the Methods for Pageimage)? I mean something like e.g. // $assetsImage is a File form e.g. urls('templates').'assets/artworks/logo.png' $assetsImage->size(200, 200) Probably there are already 1000 forum entries for this anyway but I probably didn't enter the correct search terms for my problem ... I would be happy if someone had a quick solution for this. Best regards, Robert
  3. @bernhard ProcessWire has a feature to track changes. If there are no changes unneeded hooks do not get fired ... of course that makes sense! Silly me, it was because I wasn't making changes to the repeater when testing, there for it wasn't firing saveReady... Of course i missed the very last sentence down there! Thanks a lot for the help! Robert
  4. By the way. Does anyone have a similar display problem in firefox and chrome regarding bolt icon for hookable methods? See the screenshot below.
  5. Hello and thanks a lot for your answers. I already knew some of the posts, but I could not solve my special problem with the solutions there. I have tried a lot now and noticed that field values with Pages::saveReady seem to change only if you actually make an entry in the PW backend and save the page. Existing field values which already exist before the hook is included (and remain "untouched" in the backend) are not changed when the page is saved. ProcessPageEdit::buildForm also works if the field input already exists and has not been changed by PW backend before saving. That's why I thought this didn't work. Something similar I've written here : Please let me know if this is total nonsense what i am writing here. I am not really familiar with hooks. Robert
  6. I had a similar problem. The following didn't work in my case: If there are already incorrect values in a repeater field (e.g. from previous entries), the hook Pages :: saveReady doesn't seem to work. Pages :: saveReady changes the repeater field only if the input is changed via backend and then saved. In other words: existing field values are apparently not checked or changed changed with Pages :: saveReady, unless the filed value is also changed in the backend. ProcessPageEdit :: buildForm also works with existing field values (contaminated areas ?) See this entry: Maybe I could be of some help here. Or maybe I'm completely wrong. Robert
  7. Thanks for your input. But unfortunately that doesn't work either ... I've already tried it. Somehow I think that couldn't work because the field to be saved is the repeater and not only a field in the repeater itselfe. My next assumption is that it would have to work very differently than my current approach, since repeaters are saved as templates in the database. In my example above as temlate 'repeater_my_repeater'. Unfortunately, I don't know how to store the fields value within the repeater via API / hook. Therefore I still ask for your help or at least a hint ?
  8. Hello androbey! Thanks for your answer. Unfortunately nothing happens. The only error message is my own WireException. The goal is that the field (represented by the variable $dateEnd) with the wrong input should be empty after saving the page in PW. I've already tried that: ... $repeater = $page->my_repeater; ... if ( $dateStart && $dateEnd && $dateStart >= $dateEnd ) { $page->of(false); // and of course 'true' too :-) $repeater->save(); throw new WireException('start date must be earlier than end date'); }//endif ... Robert
  9. Hi there! I am unfortunately unable to change (empty) the entry of a repeater field via a hook in ready.php. wire()->addHookAfter("Pages::saveReady", function (HookEvent $event) { $page = $event->arguments("page"); if ( $page->hasField('my_repeater') ) { $repeater = $page->my_repeater; foreach ( $repeater as $item ) { $dateStart = $item->date_start; $dateEnd = $item->date_end; if ( $dateStart && $dateEnd && $dateStart >= $dateEnd ) { // $page->of(true); // that doesn't help either $dateEnd = ''; // !!!! that dosen't work !!!! throw new WireException('start date must be earlier than end date'); }//endif }//endforeach }//endif }); What am I doing wrong? I've tried so much, read the documentation, searched the forum and google, but I can't find a solution. Please help me ? Robert
  10. Thanks, that's it!☺️ Now of course I've found that too ... https://processwire.com/talk/topic/22516-when-using-js-fetch-it-seems-config-ajax-is-ignored/
  11. Hi there. I have an annoying problem with a page where I load content dynamically with AJAX. (ProcessWire 3.0.148) I'm using MarkupRegions with the following code fragments: PHP template-files // +++ _main.php +++ if( !$useMain || $config->ajax ) return; ... // +++ page with the dynamic AJAX content +++ ... if ($config->ajax) { wireIncludeFile('./_includes/wine.inc.php', $arrOut); return $this->halt(); }//endif ... JS file // +++ main.js (function(){ var dynamicModals = document.querySelectorAll('[data-toggle="ajaxModal"]'); if (!dynamicModals.length) return; for (var i = 0, len = DynamicModals.length; i < len; i++) { dynamicModals[i].addEventListener('click', function(e) { e.preventDefault(); var url = this.getAttribute('href'); var ajaxModal = document.getElementById('ajaxModal'); if( ajaxModal ) { var modalDiv = AjaxModal; } else { // +++ modal var modalDiv = document.createElement('div'); modalDiv.id = 'ajaxModal'; modalDiv.setAttribute('data-uk-modal', ''); modalDiv.classList.add('uk-modal-center', 'uk-flex-top', 'uk-modal'); document.body.appendChild(modalDiv); }//end if var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var modal = document.getElementById(modalDiv.id); var data = this.responseText; var html = '<div class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical">'; html += '<button class="uk-modal-close-full uk-close-large" type="button" data-uk-close></button>'; html += data; html += '</div>'; modal.innerHTML = html; UIkit.modal(modal).show(); } }; xhttp.open('GET', url + '?q=notUsed', true); xhttp.send(); }); }//endforeach })(); The problem is that sometimes the $config->ajax does not work or is ignored and the entire _main.php template file is loaded with AJAX-request. No error is displayed in the browser console. The content is also shown in the modal box, only sometimes with the data of _main.php. I've tried so much, but nothing helps! Does anyone have a similar problem??? Robert
  12. Hi. I have a problem with the "link field" and PW 3.0.96 . When I try to select a page (page tree) the "Choose" button disappears. Unfortunately it is no longer possible to make a selection. Does anyone have the same problem or a quick solution for it? I think the error is not the module, but the file "ProcessPageList.js" Thanks, Robert
  13. Hi Robin. As expected, the sorting works perfectly now! Thanks, Robert
  14. Hi Robin, thanks for your reply. I think it‘s exactly what I‘m looking for. I will try it in the next few days... Thanks, Robert
  15. Hi, Is there an easy way to change the sorting of the template-selection when adding pages (Page Add Process)? It would be nice if sorting in the select-field is by template-title instead of template-name... E.g: 01 - Templatetitle 1 02 - Templatetitle 2 ... Thanks
×
×
  • Create New...