Jump to content

FrontendForms - A module for creating and validating forms on the frontend


Juergen

Recommended Posts

Hello @ all

I want to share a new module with you, which makes the creation and validation of forms easy.  Take a look at the following example of a simple contact form:

// A very simple example of a contactform for demonstration purposes

$form = new Form('contactform');

$gender = new Select('gender');
$gender->setLabel('Gender');
$gender->addOption('Mister', '0');
$gender->addOption('Miss', '1');
$form->add($gender);

$surname = new InputText('surname');
$surname->setLabel('Surname');
$surname->setRule('required');
$form->add($surname);

$name = new InputText('name');
$name->setLabel('Name');
$name->setRule('required');
$form->add($name);

$email = new InputText('email');
$email->setLabel('E-Mail');
$email->setRule('required');
$form->add($email);

$subject = new InputText('subject');
$subject->setLabel('Subject');
$subject->setRule('required');
$form->add($subject);

$message = new Textarea('message');
$message->setLabel('Message');
$message->setRule('required');
$form->add($message);

$privacy = new InputCheckbox('privacy');
$privacy->setLabel('I accept the privacy policy');
$privacy->setRule('required')->setCustomMessage('You have to accept our privacy policy');
$form->add($privacy);

$button = new Button('submit');
$button->setAttribute('value', 'Send');
$form->add($button);

if($form->isValid()){

  print_r($form->getValues());
  // do what you want

}

// render the form
echo $form->render();

This piece of code creates a simple contact form and validates it according to the validation rules set. Inside the isValid() method you can run your code (fe sending an email)

Highlights:

  • 30+ validation types
  • Support for UiKit 3 and Bootstrap 5 CSS framework
  • SPAM protection
  • Highly customizable
  • Hookable methods for further customization
  • Multi-language

You can download and find really extensive information on how to use at https://github.com/juergenweb/FrontendForms.

Please report errors or suggestions directly in GitHub.

Best regards and happy testing ?

If you have downloaded the module in the past I recommend you to uninstall the module completely and install the newest version 2.1.14. There are a lot of changes in the new version, so please test carefully.

  • Like 25
  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

Hi 

I tried to install the module to processwire (latest version) and got a fatal error:

Aw shucks… Fatal Error: Uncaught Error: Using $this when not in object context in C:\xampp\htdocs\p20\site\modules\FrontendForms\FrontendForms.module:41

After changing line 41 in FrontendForms.module from:

Link to comment
Share on other sites

Hi Juergen,

I tried to install the module to processwire (latest version) and got a fatal error:

Aw shucks… Fatal Error: Uncaught Error: Using $this when not in object context in C:\xampp\htdocs\p20\site\modules\FrontendForms\FrontendForms.module:41

After changing line 41 in FrontendForms.module and remove the '$this' module installed in processwire. The line 41 changed to:
'summary' => 'Create forms and validate them using the Valitron library.',

Just writing this remark as maybe help some other users in module installation. I am going to test your module in the following days. 

Thanks for your work

  • Thanks 1
Link to comment
Share on other sites

Hello @sp1ke

thank you for your issue report. This error was produced by my editor during find and replace process. It is not possible to use $this inside the module info method. I have replaced all translateable strings from __('My string') to $this->_('My string') because using $this is the prefered method inside the class of a module. During these replacements I have overlooked the replacement inside the module info method.

I have replaced it on GitHub to:

'summary' => __('Create forms and validate them using the Valitron library.'),

So in this case the string is also translateable.

Thanks

  • Like 1
Link to comment
Share on other sites

Hi Juergen,

I made a template based on your example code for simple contact page. But I get an error message:

Aw shucks… Fatal Error: Uncaught TypeError: Argument 1 passed to Form::add() must be an instance of object, instance of Select given, called in C:\xampp\htdocs\p20\site\templates\contact.php on line 13 and defined in C:\xampp\htdocs\p20\site\modules\FrontendForms\Formelements\Form.php:203

I am attaching a screenshot of the error message and also part of the template file. Can you please help me on that?

Thanks in advance

frontendforms-er_message.jpg

frontendforms-template.jpg

Link to comment
Share on other sites

Hello

This is very strange, because I have no problems and the error message will also make no sense. I have installed it on a new install of PW without problems.

The problem is the type hinting in this case:  The method add() expects an object and the variable $gender in your case is an object - it is an object of the class Select. So there should not be a problem, but you can try the following:

// Replace this code in FrontendForms/FormeElements/Form.php line 203

public function add(object $field)

// with this code 

public function add($field)

But before removing the type hinting from this method, please try the following:

For testing purposes remove the add() method by the select field and take a look if the problem persists with other fields (fe. the name input field).

Which version of PHP do you use?

Please let me know!

 

Link to comment
Share on other sites

Hi Juergen,

I replaced the code in FrontendForms/FormeElements/Form.php line 203
public function add(object $field)
// with this code 
public function add($field)

as you suggested and the module is working fine now.

Versions information:
ProcessWire: 3.0.184
PHP: 7.1.18 (XAMPP server)

Thank you for your quick reply.

Have a nice day!

Link to comment
Share on other sites

Hello @sp1ke

glad to hear that, but I would recommend you to update your PHP version to at least 7.2+, because object type hinting is only possible with higher PHP versions. Otherwise you will get this error message everytime someone uses object type hinting (like me ;-).

Best regards

 

Link to comment
Share on other sites

Hello,

Thank you for your suggestion to update my PHP version. I will do it asap. I have another question: it's from the README.md file and about the sanitizer:

#### setSanitizer()

Method to add a sanitizer to the form field. Returns a sanitizer object. You can use all ProcessWire sanitizer methods by adding the sanitizer name inside the parenthesis of the setSanitizer() method. You can also set multiple sanitizer methods to one field if necessary.
Please note: For security reasons, the text sanitizer will be applied to each inputfield automatically, so you do not have to add it manually. The only exception is input textarea, where a textarea sanitizer will be applied by default.

What confused me is the 'Please note' paragraph. As I cannot understand the difference between inputfield and textarea: which one is automatically sanitized and why textarea is an exception. Do I have manually do the sanitization of the textarea input or not?

For the rest, your documentation is excellent. Very clear instructions how to use the module and also a lot of examples. Very helpful - great job!

Thanks in advance.

Link to comment
Share on other sites

Hello @sp1ke

3 hours ago, sp1ke said:

As I cannot understand the difference between inputfield and textarea

An inputfield is a single line input and textarea is a multiline input. ProcessWire provides an extra sanitizer for textareas. Take a look at https://processwire.com/api/ref/sanitizer/textarea/ .

Using "sanitizer text" for normal inputfields and "sanitizer textarea" for textareas was my personal choice. These 2 sanitizers will be applied by default - no need for you to do it manually. This is only for security reasons.

If you are not satisfied with it, you can disable the sanitizer on each field by using the removeSanitizers() method.

Take a look at this example:

$surname = new InputText('surname');
$surname->setLabel('Surname');
$surname->setRule('required');
$surename->removeSanitizers();// this line removes the text sanitizer from this inputfield
$form->add($surname);

In this case the value will not beeing sanitized, but this is not recommended (especially if you are storing values in the database).

If you want to add a special sanitizer for an input, you can use all sanitizers that will be shipped with ProcessWire. See a list of all available sanitizers at https://processwire.com/api/ref/sanitizer/

Example: You want to use the following sanitizers from ProcessWire:

$sanitizer->alpha(string $value) //Sanitize to ASCII alpha (a-z A-Z)
$sanitizer->camelCase(string $value) //Convert string to be all camelCase

All you need to do is to use the setSanitizer(name of the sanitizer in ProcessWire) method.

$surname = new InputText('surname');
$surname->setLabel('Surname');
$surname->setRule('required');
$surename->removeSanitizers();// this line removes the text sanitizer from this inputfield
$surename->setSanitizer('alpha'); // this adds the alpha sanitizer
$surename->setSanitizer('camelCase');// this adds the camelCase sanitizer
$form->add($surname);

Using camelCase sanitizer for the surename makes no sense in real life, so it is only applied as an example ?

Hope it will be a little bit clearer.

  • Like 1
Link to comment
Share on other sites

Hi Juergen,

Thank you again for your very detailed and informative reply. It really made everything crystal clear. 

These days I am finishing a translation of language csv file in greek. Would you like to send it to you, so you can add it to the module language file? Do you believe it would be better if I send you a separate csv file only with the greek translation so you may just add the new column to your csv file?

Have a nice day!

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Hello @Flashmaster82,

11 hours ago, Flashmaster82 said:

How can i send the form to an email?

There are different ways - the most simple one is to use PWs built in Mail class:

Here is a working example (not tested but it should work ;-))

$form = new Form('contactform');

$gender = new Select('gender');
$gender->setLabel('Gender');
$gender->addOption('Mister', '0');
$gender->addOption('Miss', '1');
$form->add($gender);

$surname = new InputText('surname');
$surname->setLabel('Surname');
$surname->setRule('required');
$form->add($surname);

$name = new InputText('name');
$name->setLabel('Name');
$name->setRule('required');
$form->add($name);

$email = new InputText('email');
$email->setLabel('E-Mail');
$email->setRule('required');
$form->add($email);

$subject = new InputText('subject');
$subject->setLabel('Subject');
$subject->setRule('required');
$form->add($subject);

$message = new Textarea('message');
$message->setLabel('Message');
$message->setRule('required');
$form->add($message);

$privacy = new InputCheckbox('privacy');
$privacy->setLabel('I accept the privacy policy');
$privacy->setRule('required')->setCustomMessage('You have to accept our privacy policy');
$form->add($privacy);

$button = new Button('submit');
$button->setAttribute('value', 'Send');
$form->add($button);

if($form->isValid()){

	  // send an email 
      $m = wireMail();
      $m->to('myEmail@test.com); // enter here the email address where the mail should be sent to - usually it is your email address
	  $m->fromName($form->getValue('gender').' '.$form->getValue('surname').' '.$form->getValue('name'));
      $m->from($form->getValue('email')); // the email address of the sender
      $m->subject($form->getValue('subject')); // the subject of the email
      $m->bodyHTML($form->getValue('message')); // the message text of the email
      $mailSent = $m->send();
	  
	  // optional check if there was an error sending the mail 
	  // true on success, false on failure
	  if(!$mailSent){ 
		$form->getAlert()->setText('There was an error sending the mail.');
		$form->getAlert()->setCSSClass('alert_dangerClass');
	  }

		// save the email as page
	  	$p = new Page(); // create new page object
		$p->template = 'email'; // set template -> you have to create the template first by yourself
		$p->parent = wire('pages')->get('template=contact'); // set the parent page 
		$p->title = $form->getValue('subject'); 
		$p->body = $form->getValue('subject'); 
		$p->save();


}

// render the form
echo $form->render();

To send an email please check the docs at https://processwire.com/api/ref/wire-mail/

By creating a new page to save the email as a page under the contact form page please take a look  at "save the email as page" section in the code above. You have to create the template and the fields for the email template first by yourself.

1) Create a template with fe the name 'email' first

2) Add the fields to the template where you want to store the data of the email (fe surname, name, subject, email address, message,....)

3) You have to set the parent page finding the parent by its template name (in the above example the contact form page uses the template 'contact')

4) Add the mail values to the email template fields and save the page.

 

Best regards

  • Like 1
Link to comment
Share on other sites

  • 7 months later...

Hello Juergen,

I test your script in localhost server and worked fine. But when I move site to the live server I got this message:

Fatal Error: Uncaught Error: Class 'processwire\Form' not found in site/templates/contact.php:63

#0 wire/core/TemplateFile.php (327): require()
#1 wire/core/Wire.php (414): TemplateFile->___render()
#2 wire/core/WireHooks.php (951): Wire->_callMethod('___render', Array)
#3 wire/core/Wire.php (485): WireHooks->runHooks(Object(TemplateFile), 'render', Array)
#4 wire/modules/PageRender.module (554): Wire->__call('render', Array)
#5 wire/core/Wire.php (417): PageRender->___renderPage(Object(HookEvent))
#6 /var/www/vhosts/san (line 63 of site/templates/contact.php)

I have used the latest version of your module. I am attaching you the form template file to check. The server's PHP version is 7.4.29

Do you have any idea what is wrong?

contact.php

Link to comment
Share on other sites

Hello Juergen,

I tried some changes in the template file - actualy just correct the 'namespace ProcessWire' command (if I don't include the namespace command there is an error message saying that cannot find the 'Form module'). Anyway, now get a new error as shown in the attached pic

frontendforms-server-error.jpg

Link to comment
Share on other sites

Hello sp1ke

This module runs in its own namespace called "Frontendforms". I have added this namespace later and have forgotten to adapt the example codes.

So if you are using the namespace "Processwire" or any other namespace you have to add the "FrontendForms" namespace before creating a new instance.

// running inside a namespace

$gender = new \FrontendForms\Select('gender');

// running outside of a namespace

$gender = new Select('gender');

You have to do it on every new instance, otherwise you will get an error message!!!!

I have adapted your code with the new namespace and it works.

$form = new \FrontendForms\Form('contactform');

$gender = new \FrontendForms\Select('gender');
switch ($curLanguage) {
    case "English":
        $gender->setLabel('Title: ');
        $gender->addOption('Mister', 'Mr.');
        $gender->addOption('Miss', 'Ms.');
        break;
    case "Ελληνικά":
        $gender->setLabel('Τίτλος: ');
        $gender->addOption('Κύριος', 'Κος');
        $gender->addOption('Κυρία', 'Κα');
        break;
    default:
        $gender->setLabel('Title: ');
        $gender->addOption('Mister', 'Mr.');
        $gender->addOption('Miss', 'Ms.');
        break;
}
                    $gender->setAttribute('class', 'w3-select w3-border w3-margin-bottom');
                    $form->add($gender);

                    $name = new \FrontendForms\InputText('name');
switch ($curLanguage) {
    case "English":
        $name->setLabel('Full Name: ');
        $name->setRule('required')->setCustomMessage('This field is required');
        break;
    case "Ελληνικά":
        $name->setLabel('Ονοματεπώνυμο: ');
        $name->setRule('required')->setCustomMessage('Το πεδίο είναι απαραίτητο');
        break;
    default:
        $name->setLabel('Full Name: ');
        $name->setRule('required')->setCustomMessage('This field is required');
        break;
}
                    $name->setAttribute('class', 'w3-input w3-border w3-margin-bottom');
                    $form->add($name);

                    $email = new \FrontendForms\InputText('email');
switch ($curLanguage) {
    case "English":
        $email->setLabel('E-Mail: ');
        $email->setRule('required')->setCustomMessage('This field is required');
        break;
    case "Ελληνικά":
        $email->setLabel('E-Mail: ');
        $email->setRule('required')->setCustomMessage('Το πεδίο είναι απαραίτητο');
        break;
    default:
        $email->setLabel('E-Mail: ');
        $email->setRule('required')->setCustomMessage('This field is required');
        break;
}
                    $email->setRule('email');
                    $email->setAttribute('class', 'w3-input w3-border w3-margin-bottom');
                    $form->add($email);

                    $address = new \FrontendForms\InputText('address');
switch ($curLanguage) {
    case "English":
        $address->setLabel('Address: ');
        $address->setRule('required')->setCustomMessage('This field is required');
        break;
    case "Ελληνικά":
        $address->setLabel('Διεύθυνση: ');
        $address->setRule('required')->setCustomMessage('Το πεδίο είναι απαραίτητο');
        break;
    default:
        $address->setLabel('Address: ');
        $address->setRule('required')->setCustomMessage('This field is required');
        break;
}
                    $address->setAttribute('class', 'w3-input w3-border w3-margin-bottom');
                    $form->add($address);

                    $message = new \FrontendForms\Textarea('message');
switch ($curLanguage) {
    case "English":
        $message->setLabel('Message: ');
        $message->setRule('required')->setCustomMessage('This field is required');
        break;
    case "Ελληνικά":
        $message->setLabel('Μήνυμα: ');
        $message->setRule('required')->setCustomMessage('Το πεδίο είναι απαραίτητο');
        break;
    default:
        $message->setLabel('Message: ');
        $message->setRule('required')->setCustomMessage('This field is required');
        break;
}
                    $message->setAttribute('class', 'w3-input w3-border w3-margin-bottom');
                    $form->add($message);

                    $button = new \FrontendForms\Button('submit');
                    $button->setAttribute('value', 'Send');
                    $button->setAttribute('class', 'w3-btn w3-round w3-blue');
                    $button->prepend('<div class="w3-padding-24 w3-center">');
                    $button->append('</div>');
                    $form->add($button);

switch ($curLanguage) {
    case "English":
        $form->setSuccessMsg('<p>Your message was submitted successfully!</p>');
        $form->setErrorMsg('<p>Sorry, but there are errors!</p>');
        break;
    case "Ελληνικά":
        $form->setSuccessMsg('<p>To μήνυμα σας στάλθηκε με επιτυχία!</p>');
        $form->setErrorMsg('</p>Υπάρχουν λάθη στη συμπλήρωση της φόρμας!</p>');
        break;
    default:
        $form->setSuccessMsg('<p>Congratulations, your message was submitted successfully!</p>');
        $form->setErrorMsg('<p>Sorry, but there are errors!</p>');
        break;
}

if ($form->isValid()) {
    // send an email
    $m = wireMail();
    $m->to('enteryouremailhere');
    $m->fromName($form->getValue('gender').' '.$form->getValue('name'));
    $m->from($form->getValue('email')); // the email address of the sender
    //$m->subject($form->getValue('subject')); // the subject of the email
	
    $m->bodyHTML($form->getValue('message')); // the message text of the email
    $mailSent = $m->send();
}

echo $form->render();

BTW you use the subject value, inside your mail function, but you do not have an inputfield for your subject. This will not work.

$m->subject($form->getValue('subject')); // the subject of the email

The new error message

I have changed the code of the Frontendforms.module file a little bit to check if a template path is provided. I recommend you download the module once more to get the latest version and replace it with the version you have on your system.

Another question: Why are you using a switch statement for your languages?

You can use translatable strings instead of a switch statement.

Best regards

 

Link to comment
Share on other sites

Here is the working code for your form by using translatable strings. You have to set your email address in email section. I have removed it to do not publish it here in the public.

 

$form = new \FrontendForms\Form('contactform');
$form->setSuccessMsg(__('Your message was submitted successfully!'));
$form->setErrorMsg(__('Sorry, but there are errors!'));

$gender = new \FrontendForms\Select('gender');
$gender->setLabel(__('Title:'));
$gender->addOption(__('Mister'), 'Mr.');
$gender->addOption(__('Miss'), 'Ms.');
$gender->setAttribute('class', 'w3-select w3-border w3-margin-bottom');
$form->add($gender);

$name = new \FrontendForms\InputText('name');
$name->setLabel(__('Full Name:'));
$name->setRule('required');
$name->setAttribute('class', 'w3-input w3-border w3-margin-bottom');
$form->add($name);

$email = new \FrontendForms\InputText('email');
$email->setLabel(__('E-Mail:'));
$email->setRule('required');
$email->setRule('email');
$email->setAttribute('class', 'w3-input w3-border w3-margin-bottom');
$form->add($email);

$address = new \FrontendForms\InputText('address');
$address->setLabel(__('Address:'));
$address->setRule('required');
$address->setAttribute('class', 'w3-input w3-border w3-margin-bottom');
$form->add($address);

$message = new \FrontendForms\Textarea('message');
$message->setLabel(__('Message:'));
$message->setRule('required');
$message->setAttribute('class', 'w3-input w3-border w3-margin-bottom');
$form->add($message);

$button = new \FrontendForms\Button('submit');
$button->setAttribute('value', __('Send'));
$button->setAttribute('class', 'w3-btn w3-round w3-blue');
$button->addWrapper()->setAttribute('class', 'w3-padding-24 w3-center');
$form->add($button);

if ($form->isValid()) {
    // send an email
    $m = wireMail();
    $m->to('enteryouremailhere');
    $m->fromName($form->getValue('gender') . ' ' . $form->getValue('name'));
    $m->from($form->getValue('email')); // the email address of the sender
    $m->subject(_('New message from the contact form()')); // the subject of the email
    $m->bodyHTML($form->getValue('message') . ' <br><br> ' . $form->getValue('address')); // the message text of the email
    $m->send();
}

echo $form->render();

 

Link to comment
Share on other sites

Hello @Juergen,
First of all thanks for the module. Unfortunately, I get 6 errors displayed during the installation.

PHP Warning: ProcessWire\FrontendForms::ProcessWire\{closure}(): Argument #2 ($key) must be passed by reference, value given in .../pwclean/site/modules/FrontendForms/FrontendForms.module:409

My system:
MAMP, PHP 8.0.8
PW-Version: 3.0.199
FrontendForms-Version: 2.0.2

Since there are only warnings, I tried to integrate it anyway.
Unfortunately without success, because I get error messages here too.

Error (in frontend):
Class "FrontendForms\Alert"
Not found
Form.php 121
File: .../pwclean/site/modules/FrontendForms/Formelements/Form.php:121

This is how your example is integrated into the template (File: _init and the test Page Template form.php): 

//_init.PHP
<?php namespace ProcessWire;

/**
 * Initialization file for template files 
 * 
 * This file is automatically included as a result of $config->prependTemplateFile
 * option specified in your /site/config.php. 
 * 
 * You can initialize anything you want to here. In the case of this beginner profile,
 * we are using it just to include another file with shared functions.
 *
 */

include_once("./_func.php"); // include our shared functions

$frontendforms = new FrontendForms();
$frontendforms->setLang('de');

// Ende init.php

//*****************************************
// (The test template):
// form.php

<?php 

include('./_uk-head.php'); // include header markup 


?>



<div class="uk-section ">
    <div class="uk-container uk-container-large">

<?php    
    $form = new \FrontendForms\Form('contactform');

    $gender = new \FrontendForms\Select('gender');
    $gender->setLabel('Gender');
    $gender->addOption('Mister', 'Mister');
    $gender->addOption('Miss', 'Miss');
    $form->add($gender);

    $surname = new \FrontendForms\InputText('surname');
    $surname->setLabel('Surname');
    $surname->setRule('required');
    $form->add($surname);

    $name = new \FrontendForms\InputText('lastname');
    $name->setLabel('Last Name');
    $name->setRule('required');
    $form->add($name);

    $email = new \FrontendForms\InputText('email');
    $email->setLabel('E-Mail');
    $email->setRule('required');
    $email->setRule('email');
    $form->add($email);

    $subject = new \FrontendForms\InputText('subject');
    $subject->setLabel('Subject');
    $subject->setRule('required');
    $form->add($subject);

    $message = new \FrontendForms\Textarea('message');
    $message->setLabel('Message');
    $message->setRule('required');
    $form->add($message);

    $privacy = new \FrontendForms\InputCheckbox('privacy');
    $privacy->setLabel('I accept the privacy policy');
    $privacy->setRule('required')->setCustomMessage('You have to accept our privacy policy');
    $form->add($privacy);

    $button = new \FrontendForms\Button('submit');
    $button->setAttribute('value', 'Send');
    $form->add($button);

    if($form->isValid()){

    print_r($form->getValues());
    // do what you want

    }

    // render the form
    echo $form->render();


?>
    </div>
</div>


<?php include('./_uk-foot.php'); // include footer markup ?>

//Ende form.php

Somehow there seems to be a problem with the "namespace" or something similar. Maybe I misunderstood something... This is the integrated code from your example that leads to the errors.

Since your module reads as a really nice solution, I'd love to use it. Can you please help. Thanks.

Christian

Link to comment
Share on other sites

Hello Christian,

thanks for informing me about the error during the installation. I have corrected it on github, so please download version 2.0.2 again to get rid of the warning.

The other problem is maybe caused by the namespace: you are not using a namespace (fe. Processwire) in your test.php. Therefore you do not need to add the namespace before the class name.

// this should be correct
$gender = new Select('gender')

// do not write 

$gender = new /FrontendForms/Select('gender') // this in only necessary if you are using a namespace in this template

//you have to correct it on each class instantiation.

I have not tried it, because I am always using a namespace in my templates, but this should solve your problem. Please let me know.

Best regards

Link to comment
Share on other sites

Hello Juergen,

I have followed your suggestion and change the source code of my file (contact.php):

$form = new \FrontendForms\Form('contactform');
$gender = new \FrontendForms\Select('gender');

Also I download the latest version from github. I still get an error message as shown in the attached picture. 

Do you have any idea why?

Thanks in advance

20220510-ContactFormError.jpg

Link to comment
Share on other sites

Hello @Juergen,
Thank you for the quick reply and correction.?
The installation errors are now gone.
 
Unfortunately, the other problem remained.
I've tried all variants to get it working to no avail.
I use a quick clean PW install with the beginner theme.

Standard profile (beginner version)

The Processwire namespace is almost everywhere here, maybe that's why. Unfortunately, I have no practical experience with namespaces and PHP OOP knowledge is unfortunately only somewhat theoretical.
 
Can you please test your module with this default base (Beginner Edition) under PW version: 3.0.199? At best, integrate exactly according to your instructions.

I copied the two lines into the existing _init.php.
Then I created a page with a template and as a template 1:1 yours Code examples integrated and tested one after the other. The same errors keep coming.

Just an idea:
Maybe it's also a problem with the names, because you use frontendforms in different CamelCase variants...?

Many greetings,
Christian

Bildschirmfoto 2022-05-10 um 10.20.21.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...