-
Posts
33 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
thausmann's Achievements

Jr. Member (3/6)
38
Reputation
-
thausmann started following MinifyPageRender , form->processInput doesn't catch missing InputfieldCheckbox , Looking for a supporting developer and 2 others
-
form->processInput doesn't catch missing InputfieldCheckbox
thausmann replied to thausmann's topic in General Support
Thanks so much Jan for double checking! You found the culprit: removing $field->attr('required', true); really makes the key difference. When I was testing, I bypassed the browser check by removing the required attribute through the dev tools. The solution is to use $field->requiredAttr = true; instead! One of those seem to have some side effects that cause the unwanted behaviour. In the past, I had a syntax error because I used $field->requiredAttr(true); which works for text inputs, but not checkboxes, interestingly. After checking the docs again, it's supposed to just be a property and not a method call. Which is a bit confusing because there is $field->required(true). -
I'm trying to create a newsletter signup form with the API and validate/sanitize it with form->processInput. It only has two inputs: email and a consent checkbox. When I submit the form with an empty or malformed email, I get form errors after calling processInput. But when I don't check the checkbox, the submission gets through without errors. It seems like setting required(true) on the checkbox has no effect. Is this normal and I have to manually sanitize checkboxes? I'd expect it to behave like the other input and automatically create an error. These functions are inside a page class: public function createForm() { $modules = $this->wire()->modules; /** @var InputfieldForm */ $form = $modules->get('InputfieldForm'); $form->method = 'post'; $form->action = $this->url; /** @var InputfieldEmail */ $field = $modules->get('InputfieldEmail'); $field->label = __('Email*'); $field->attr('id+name', 'email'); $field->attr('placeholder', $field->label); $field->required(true); $field->requiredAttr(true); $form->append($field); /** @var InputfieldCheckbox */ $field = $modules->get('InputfieldCheckbox'); $field->label = '%consent_label%'; $field->attr('id+name', 'newsletter_consent'); $field->attr('required', true); $field->required(true); $form->append($field); ... return $form; } public function progressInput() { $input = wire()->input; $this->form = $this->createForm(); if($input->post('newsletter_submit')) { // Process the form with current input $this->form->processInput($input->post); $errors = $this->form->getErrors(); if(!count($errors)) { $this->subscribeToMailchimp(); } } } Template: $page->progressInput(); $errors = $page->form->getErrors(true); if(count($errors) > 0) { foreach($errors as $error) { echo $error; } } echo $page->form->render();
-
True, took some extra effort to setup a Tailwind 4 project some weeks ago, in form of .cursorrules listing all the new features. Then it worked surprisingly well.
-
Hi, to support modern displays, I'm trying to get a 2X version of my crop. The crop is defined in 1X resolution like this: teaser,320,240 Here is what I tried: $img->getCrop('teaser', 'hidpi=true')->url; // no effect, just returns the original crop URL $img->getCrop('teaser', 'width=640')->url; // pixelated, seems to upscale the 320 crop Is there an easy way to get a 2X, 3X etc. of the crop? CroppableImage3 1.2.0, the original image is 1600px wide. Edit: I guess that's intended, so my workaround is to define the crops in the highest resolution and only scale down from there.
-
@kaz it depends what you want: To redirect www to non-www, uncomment 13C (lines 332-333) To redirect non-www to www, uncomment 13A (lines 320-323) OR (if that doesnt work) 13B (327-328)
-
It's recommended to decide for one version (with or without www) and always redirect to the one and only. In the default ProcessWire htaccess file, there are predefined rules to do that (remove # from the "Rewrite..." lines to enable the rules). I don't think the order matters, but not sure on this one. What happens when you access the full logo.svg URL without www?
-
FYI I eventually merged the multievents into the main branch. So updating this module from 1.2 to 2.0 requires refactoring. All data is moved to the events property (WireArray), no matter if single or multiple events. // get the module $icsgen = wire()->modules->IcsGenerator; // create a new event using date strings $myEvent = new WireData([ 'summary' => 'Christmas 2033', 'dtstart' => '2033-12-24 18:00', 'dtend' => '2033-12-24 22:00' ]); // add to events $icsgen->events->add($myEvent);
-
Dear ProcessWire community, Over the last years I created many small–medium websites for classic musicians among other things. I have grown to a point where I cannot support all projects in a timely manner, so I look for some support on code level. (Some websites are oldschool PHP templates, some are headless with a Svelte or Next.js frontend.) Tasks may involved Implementing new screens and features (designs provided by me) Refactoring oldish static fields to more flexible repeater layout Maintenance (Updating ProcessWire, PHP Versions) Requirements Experience with ProcessWire, HTML, Vanilla JS, jQuery, CSS, Sass, node.js build tools, Git, SFTP Ability to estimate tasks, plan and deliver on time Billed by the hour based on estimates Nice to have, but not required Experience with custom ProcessWire Modules, Docker, Svelte, React, Next.js, Typescript, THREE.js, R3F, GDPR complience Eye for design details Germany based / German speaking Please send me a DM if you are interested so we can discuss details.
- 1 reply
-
- 2
-
-
@ZAP hmm that's weird, can you search for MinifyPageRender in your project and see if it comes up twice, maybe delete the cache? Searching the forum for this yields some older reports of similar errors, but no definite solution.
-
@Ralf alright I'm on it. The new approach is a WireArray events property, that can hold data for one or more events. // get the module $icsgen = wire()->modules->IcsGenerator; // add an event $icsgen->events->add([ 'summary' => 'Event Title 1', 'description' => 'Event body 1', 'dtstart' =>'2033-12-24 12:00', 'dtend' => '2033-12-24 14:00', ]); This is a breaking change, rest of the API stays the same. Here is a working prototype so you can already test it if you like. I aim for a new version that also supports most ICS event properties like last-modified etc. Edit: should be mostly done, just have to add some docs. Maybe someone can test it in Outlook.
-
@Ralf Currently only one date per file is supported. Multiple events seems to be possible with multiple VEVENTS. I'm not sure if I should add it, because as mentioned there, Outlook doesn't seem to handle it well. Reoccuring events also come to mind, this should be easy to implement.
-
I created a Pull Request with two fixes. Fixed a bug that formatted Hexcodes starting with 0E to 000000 (Issue #12) Added CSS to distinguish fields with no value (red strike through)
-
The module isn't working for me aswell. I did some debugging and the issue seems to be having a <header> element in the HTML anywhere before an email address. This issue was mentioned earlier and allegedly fixed, but the problem I'm facing is gone when changing my <header> to a <div>. This obfuscate method should probably skip replacing addresses in the <head>, but cannot distinguish it from <header>. Adding a negative lookahead to the <head regex seems to fixes this issue. Here is a Git diff that's working for me. [Pull Request] Edit: just a conceptional thought, to support obfuscation everywhere, I could imagine a regex matching any email address in the entire HTML, and collect obfuscated attributes in a custom attribute, something like data-emo="title,value,innerHTML".
-
Hey @jploch, oh yes, getFile() only creates temporary files, they are deleted automatically when ProcessWire is done with the request. That may sounds weird, but my use case was to send ICS via E-Mail. To permanently store the file somewhere, I could imagine something like this: // write ICS to a custom file // https://processwire.com/api/ref/wire-file-tools/file-put-contents/ $str = $icsgen->getString(); $files->filePutContents('/my/server/path/event.ics', $str); or // add the temporary file to a file field (field named "ics_files") // https://processwire.com/talk/topic/15928-adding-a-file-to-pagefiles-and-saving-to-database/ $path = $icsgen->getFile(); $page->of(false); $page->ics_files->add($path); $page->save('ics_files'); Both untested, let me know if this works.
-
I looked at my HTML output today and all this chaotic whitespace triggered my OCD. This module simply hooks into Page::render and removes whitespaces from frontend HTML with a simple regex replace. I mostly put this together for cosmetics. I like my View source neat and tidy. This is not well tested yet, please open an issue if you run into problems. GitHub: https://github.com/timohausmann/MinifyPageRender