Susticle
Members-
Posts
18 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Susticle's Achievements
Jr. Member (3/6)
1
Reputation
-
[Solved] Page Field: select children of the page (2022)
Susticle replied to Susticle's topic in Getting Started
Wow. I found the thread you noticed and I've tried several things there. Nothing worked. Now I tried again and it works like a charm. Thank you very much! -
Hi all, I have a similar question as asked in this old thread: Case: I'm editing a page called "podcast". Children have the template "episode". Now I created a manually sortable list of featured episodes. This works quite nice. Input field type is "Page Auto Complete", filtered for template "episode". When searching for an episode to select, all episodes are searched. I would like to only search for episodes of the podcast I'm currently editing, so only for childs of the currently edited page. I found several threads about similar questions, some referring to "Custom php code". But this is not offered in the UI. Does anybody have a hint, maybe for a selector string? Sorry if this is a silly question. Thanks!
-
Hello, I got a new development machine and installed a new XAMPP version. After setting up a working ProcessWire installation I get this error on page save: ProcessWire: ProcessPageEdit: SQLSTATE[42000]: Syntax error or access violation: 1139 Got error 'invalid UTF-8 string at offset 26' from regexp I cleared the cache, setup MariaDB for UTF-8, but the problem is still there. Do you have any suggestions? Thank you! Edit: I found out that the problem happens in a self written module. There is the following statement: foreach($arr_keywords as $str_keyword) { $arr_selectors[] = 'fieldname~='.wire('sanitizer')->selectorValue($str_keyword); } If there is a UTF-8 char in $str_keyword the error occurs. Changing the operator does help. But I would like to learn what I'm doing wrong there. Thank you!
-
Backend complains about missing values after filling in hook
Susticle replied to Susticle's topic in API & Templates
Right. I should have been more precise there. Sorry. I had no doubts that this way might be the problem but I was wring. I filled the input fields and thought that this should work. Your simple answer solved my problem. Thank you very much! -
Backend complains about missing values after filling in hook
Susticle replied to Susticle's topic in API & Templates
Thanks for your reply! Hooking before "Pages::save" shows exactly the same behavior. I saw the module written by @ryan but our data structure is different and I have an own library to get the coordinates. It works quite well and matches all the needs I had and have for several projects. I would like to learn what I am doing wrong. Most likely there will be other cases I could need this knowledge about filling required fields and save without errors. :-) -
Hello, I have a template with various fields to input address data. These inputs are used in a hook to do geocoding via a Google API. Also there are two required fields, for latitude and longitude. When I add data in the page editor of Processwire and save, my module fills these fields with data given by Google. This works quite well. My problem is: Processwire says that required values are missing but displays the correct values in the fields. If I do a second save, everything is fine. This is the hook I used: public function init() { $this->pages->addHookBefore('ProcessPageEdit::processInput', $this, 'doGeocoding'); } Note: I also tried "addHookAfter", no change. So everything is fine but an error is shown. Do you have an hints? Thank you!
-
Search problem with AND and OR and modified query
Susticle replied to Susticle's topic in General Support
Thank you! I tried OR groups but didn't get them together to get the desired result. In the meantime I found out that the cause of the problem seems to be the Multi-dot selector. Not just for the OR '|' fields but also for my approach with the array. The parts of the array are working with AND logic until I add the part with the Multi-dot selector. So I did a little workaround: There are two searches now. The first one does an OR search in facility_jobs.facility_job.job_title with all given words. The resulting list of IDs is now a filter for the selector array instead of the Multi-dot selector. This seems to work quite well now. Maybe this can be done with one request using sub-selectors. I will look into this later. -
Search problem with AND and OR and modified query
Susticle replied to Susticle's topic in General Support
Thank you very much. I'll look into this! -
Search problem with AND and OR and modified query
Susticle replied to Susticle's topic in General Support
Thanks for your answer. This was the first way I tried it. But it results in an error message: -
Hello, there is (simplified): a template "job" field "job_title" a template "facility" field "facility_title" repeater "facility_jobs" field "facility_job_title" field "facility_job_description" field "facility_job" => pagereference to pages using the template "job" The facility template has a repeater to list jobs with an own name and description for this facility. In this repeater there is also a page reference to the template job. Everything is fine so far and everything works. But I don't get a search solved as I want. I need a result if *every* given word to search for matches facility_title OR facility_jobs.facility_job_title OR facility_jobs.facility_job.job_title. So template=facility AND (word1%=facility_title OR word1%=facility_jobs.facility_job_title OR word1%=facility_jobs.facility_job.job_title) AND (word2%=facility_title OR word2%=facility_jobs.facility_job_title OR word2%=facility_jobs.facility_job.job_title) AND (word3%=facility_title OR word3%=facility_jobs.facility_job_title OR word3%=facility_jobs.facility_job.job_title) I need this in one big selector because I do manual changes on the generated sql statement later. I created a selector array: foreach($arr_words as $i_number => $str_word) { $arr_selector[] = array( 'template' => 'facility', 'field' => 'title', 'operator' => '%=', 'value' => $str_word, 'group' => 'group'.$i_number ); $arr_selector[] = array( 'template' => 'facility', 'field' => 'facility_jobs.facility_job_title', 'operator' => '%=', 'value' => $str_word, 'group' => 'group'.$i_number ); $arr_selector[] = array( 'template' => 'facility', 'field' => 'facility_jobs.facility_job.job_title', 'operator' => '%=', 'value' => $str_word, 'group' => 'group'.$i_number ); } Sadly this doesn't work. It creates an OR-result. I need group1 AND groupX, but I get group1 OR groupX. I tried lots of stuff, but don't get it solved. Because of later changes to the sql statements, performance reasons, pagination I only want to search once. Any help is appreciated. Thank you! :-)
-
Hook: Populate field value and don't save on error
Susticle replied to Susticle's topic in General Support
Thanks for the answers. After discussing this we changed some things, now the way described above is appropriate. -
Hi, I wrote a little module which determines the value for an read-only inputfield depending on two other required text fields. If the necessary value cannot be found, saving should be prohibited but the entered values should stay in there. I used the hook "ProcessPageEdit::processInput" as described here and almost everything works fine. But there is one thing: The values are saved even if I detected an error. Is there a way to prevent this? I tried the hook "saveReady" but then the given values are lost in case of errors. Thanks!
-
I was wrong in my previous post, sorry. The cookie I saw was not set by Processwire. So the code found in this post works for me.