Jump to content

mjut

Members
  • Posts

    29
  • Joined

  • Last visited

  • Days Won

    1

mjut last won the day on September 26 2023

mjut had the most liked content!

Recent Profile Visitors

2,171 profile views

mjut's Achievements

Jr. Member

Jr. Member (3/6)

23

Reputation

  1. @Juergen wow! So good! Thanks for putting this up. This helps a lot. Not just for this form, I can actually learn from how you've rewritten certain snippets of this code. Thanks again!
  2. hmmyes. But that would make things even more complicated? (I am not really familar with ajax.) By the way: its super helpful that you provided the exmple files. very good organised an written. big ups!
  3. Thank you so much for the detailed answer! I see, there is a lot to learn for me ? I did use and edited your example from github contactform-2.php: <?php declare(strict_types=1); namespace ProcessWire; /* * File description * * Created by Jürgen K. * https://github.com/juergenweb * File name: contactform-2.php * Created: 15.02.2023 */ $form = new \FrontendForms\Form('contact'); $form->setMaxAttempts(0); // disable max attempts //$contacttype = new \FrontendForms\InputCheckboxMultiple('auswahl'); $contacttype = new \FrontendForms\InputRadioMultiple('auswahl'); //$contacttype->setNotes('*'); $contacttype->addOption('Einzelperson (Jahresbeitrag 50,00 EUR)<span class="asterisk">*</span>', 'Einzelperson (Jahresbeitrag 50,00 EUR)'); $contacttype->addOption('Doppelmitgliedschaft (Jahresbeitrag 75,00 EUR)<span class="asterisk">*</span>', 'Doppelmitgliedschaft (Jahresbeitrag 75,00 EUR)'); $contacttype->alignVertical(); $contacttype->setRule('required'); $form->add($contacttype); // add the gender field $gender = new \FrontendForms\Gender('gender'); //$gender->setLabel('Auswählen'); // so Label setzen! $form->add($gender); // add the name field $name = new \FrontendForms\Name('firstname'); $form->add($name); // add the surname field $surname = new \FrontendForms\Surname('lastname'); $form->add($surname); // add the name2 field $name2 = new \FrontendForms\InputText('firstname2'); $name2->setLabel('Vorname (zweite Person)'); $form->add($name2); // add the surname2 field $surname2 = new \FrontendForms\InputText('lastname2'); $surname2->setLabel('Nachname (zweite Person)'); $form->add($surname2); // Adresse $adresse = new \FrontendForms\InputText('adresse'); $adresse->setLabel('Straße und Hausnummer'); $adresse->setRule('required'); $form->add($adresse); // plz $plz = new \FrontendForms\InputText('plz'); $plz->setLabel('Postleitzahl'); $plz->setRule('required'); $form->add($plz); // Ort $ort = new \FrontendForms\InputText('ort'); $ort->setLabel('Ort'); $ort->setRule('required'); $form->add($ort); // add the email field $email = new \FrontendForms\Email('email'); if ($user->isLoggedIn()) { $email->setDefaultValue($user->email); } $form->add($email); // add the phone field $phone = new \FrontendForms\Phone('phone'); $phone->setLabel('Telefon / Mobil'); $phone->setRule('required'); $form->add($phone); // add the Geburtstags field $geb = new \FrontendForms\Phone('geb'); $geb->setLabel('Geburtsdatum'); $form->add($geb); $einzug = new \FrontendForms\InputCheckbox('einzug'); $einzug->setLabel('Hiermit ermächtige ich den Museumsverein Celle e.V. widerruflich, die von mir zu entrichtende Beitragszahlung jährlich bei Fälligkeit zu Lasten meines Kontos mittels Lastschrift einzuziehen. Wenn mein Konto die erforderliche Deckung nicht aufweist, besteht seitens des kontoführenden Geldinstituts keine Verpflichtung zur Einlösung.'); $einzug->setRule('required')->setCustomMessage('Bitte bestätigen Sie die Einzugsermächtigung.');; $form->add($einzug); // Kontoinhaber $kontoinhaber = new \FrontendForms\InputText('kontoinhaber'); $kontoinhaber->setLabel('Kontoinhaber'); $kontoinhaber->setRule('required'); $form->add($kontoinhaber); // Kreditinstitut $kreditinstitut = new \FrontendForms\InputText('kreditinstitut'); $kreditinstitut->setLabel('Kreditinstitut'); $kreditinstitut->setRule('required'); $form->add($kreditinstitut); // BIC $bic = new \FrontendForms\InputText('bic'); $bic->setLabel('BIC'); $bic->setRule('required'); $form->add($bic); // IBAN $iban = new \FrontendForms\InputText('iban'); $iban->setLabel('IBAN'); $iban->setRule('required'); $form->add($iban); // add the privacy field $privacy = new \FrontendForms\Privacy('privacy'); $form->add($privacy); // add the send copy field $sendcopy = new \FrontendForms\SendCopy('sendcopy'); $form->add($sendcopy); $button = new \FrontendForms\Button('submit'); $button->setAttribute('value', 'Absenden'); $form->add($button); if ($form->isValid()) { /** You can grab the values with the getValue() method - this is the default (old) way */ /* $body = $m->title; $body .= '<p>Sender: '.$form->getValue('gender').' '. $form->getValue('firstname').' '.$form->getValue('lastname').'</p>'; $body .= '<p>Mail: '.$form->getValue('email').'</p>'; $body .= '<p>Subject: '.$form->getValue('subject').'</p>'; $body .= '<p>Message: '.$form->getValue('message').'</p>'; */ /** You can use placeholders for the labels and the values of the form fields * This is the modern new way - only available at version 2.1.9 or higher * Big advantage: You do not have to use PHP code and there are a lot of ready-to-use placeholders containing fe the current date, the domain,..... * But it is up to you, if you want to use placeholders or do it the old way * */ $body = '[[TITLE]] [[AUSWAHLVALUE]]<br><br> [[GENDERVALUE]]<br> [[FIRSTNAMELABEL]]: [[FIRSTNAMEVALUE]]<br> [[LASTNAMELABEL]]: [[LASTNAMEVALUE]]<br> [[FIRSTNAME2LABEL]]: [[FIRSTNAME2VALUE]]<br> [[LASTNAME2LABEL]]: [[LASTNAME2VALUE]]<br> [[ADRESSEVALUE]]<br> [[PLZVALUE]]&nbsp; [[ORTVALUE]]<br> [[EMAILVALUE]]<br> [[PHONELABEL]]: [[PHONEVALUE]]<br> [[GEBLABEL]]: [[GEBVALUE]]<br><br> [[KREDITINSTITUTLABEL]]: [[KREDITINSTITUTVALUE]]<br> [[KONTOINHABERLABEL]]: [[KONTOINHABERVALUE]]<br> [[BICLABEL]]: [[BICVALUE]]<br> [[IBANLABEL]]: [[IBANVALUE]]<br><br> // send the form with WireMail $m = wireMail(); if ($form->getValue('sendcopy')) { // send copy to sender $m->to($form->getValue('email')); } $m->to('mail@mail.de')// please change this email address to your own ->from($form->getValue('email')) ->subject('Ein neuer Mitgliedsantrag von ' . $form->getValue('firstname') . ' ' . $form->getValue('lastname')) ->title('<h1>Neuer Mitgliedsantrag</h1>') // this is a new property from this module ->bodyHTML($body) ->sendAttachments($form); if (!$m->send()) { $form->generateEmailSentErrorAlert(); // generates an error message if something went wrong during the sending process } } $content .= $form->render(); echo $content; When selecting the option for "Doppelmitgliedschaft" the fields $name2 ('firstname2') and $surname2 ('lastname2') should appear.
  4. $contacttype = new \FrontendForms\InputRadioMultiple('auswahl'); $contacttype->addOption('Einzelperson'); // 1 person $contacttype->addOption('Doppelmitgliedschaft'); // 2 persons $contacttype->alignVertical(); $contacttype->setRule('required'); $form->add($contacttype); This is to add the Radio-Buttons to my form. Works perfectly. After that I add form-fields for name, surname, adress etc. The working example is living here: https://www.museumsvereincelle.de/der-verein/mitglied-werden/ My idea was to hide certain fields when option 1 is selected (1 Person) and show specific fields when option 2 is selected (2 persons). (Sorry for the complicated description. As the example is in German... )
  5. Thanks for this awesome module!! I am running it on various installations without any issues and flaws! ? Now, a client wants to show form fields only, if the user selected one check box. In the file, I am calling InputRadioMultiple to integrate various buttons. How to I validate for one specific button being checked to show additional form fields? Happy for any input. Thanks a lot!!!
  6. Nice qtguru! I never really looked into twig. I am curious now. ?
  7. Here is the script: #!/usr/bin/php <?php namespace ProcessWire; include("/home/stephan/www/index.php"); foreach ($pages->find("template=post, status=unpublished, sort=unpublished, limit=1") as $post) { $post->removeStatus('unpublished'); $post->addStatus('published'); $post->save(); } With cron it is triggered once a day and it will look for unpublished posts. If there are any, the oldest post will get published. Simple as that. I am using this script to update my photo blog https://photos.stephansimonis.com more regularly. ?
  8. Hi forum, I don't really know how to do this: I want to create multiple (not published but saved) pages. From that on, I want the pages to be published each page a day aromatically. I am sure, this is possible.. But where do I begin? Thanks for suggestions and input. Cheers Stephan
  9. mjut

    Appreciation

    Oh yes! I remember that one!
  10. Alright. It wasn't a MySQL-issue at all! In my search-template I've been using the selector fields incorrectly. I wanted a page-referenece field to be searched and listed. in the selectors I called "pagereference" what I need to do was putting "pagereference.title" into the selectors! Without putting *title after the field, the results were based on searching the url. That led to results I wasnt expecting...
  11. mjut

    Appreciation

    I did revised and recoded my personal blog (journal). It is running with Processwire smoothly since years. A decade ago I started that journal using Textpattern.. So I thought, hey, why not putting it back to Textpattern? I still have a lot of sympathy to Textpattern. Probably because it is the system I learned on.. After setting it all up – it made me giggle every time when I remembered how to do, and work around things – I was happy with the result. After this little travel back in time, I deleted Textpattern again to keep on using Processwire. Nothing else to say. Why am I posting this little story? I dont know... But this might be the right place where people understand what I am saying.. ;) Thanks a lot!
  12. Perfect! Works as it is supposed to do. I just installed the module on my online journal / blog. Keep in mind: encrypted fields are not searchable anymore.
  13. I am experiencing the same issue – changing the collation did not fix it. But maybe it is something different? When searching for Lüneburg the word is being found in all body-fields (textarea) but not in title-fields (the system generated text field). Replacing the Ü with U, I'll get the desired results. Here comes the weird behavior: When searching vor üneburg (umlaut it the beginning of the word) all results with "Lüneburg" in the title-field are being found and listed!!! Isnt that weird? I did look into the database: all tables are set to utf8_general_ci. Changing them to utf8_unicode_ci or even utf8mb4_unicode_ci did not change a thing. I am not sure, where to look into next?
  14. I just used this today – very handy. I specified a template too: wire()->addHookBefore('Page::addable', null, function ($e) { if ($e->object->parents("template=basic-page")->count > 1) $e->object->template->noChildren = 1; });
×
×
  • Create New...