Jump to content

Recommended Posts

Posted
<?php namespace ProcessWire; 

	

$form = $modules->get('FormTemplateProcessor');$form->template = $templates->get('book-now'); // required
$form->requiredFields = array('title', 'email', 'number','body');
//$form->email = 'your@email.com'; // optional, sends form as email
$form->parent = $page('template=book-now'); // optional, saves form as page
//$form->render();  // draw form or process submitted form




?>

	<?php echo $form->render(); ?>

 

 

using this to for a contact on new processwire version 3  and I am receiving this error

 

Error: Uncaught Error: Call to undefined method stdClass::render() in C:\wamp64\www\mbs\site\templates\book-now.php:9

 

tried following but none of them works

 

render(array('name','email','body',))

wireRender()

 

Render()

wire()

 

anyone ?  

Posted

The error message you posted does not fit with the code.

You got that error when you tried it with render(array('name','email','body',))

What error do you get with the actual code that you posted?

EDIT: Sorry for that

Posted
1 hour ago, flydev said:

If you put namespace ProcessWire; on top of the module file, does it work ?

nope not working

 

 

5 minutes ago, gebeer said:

The error message you posted does not fit with the code.

You got that error when you tried it with render(array('name','email','body',))

What error do you get with the actual code that you posted?

code is here

 

<?php namespace ProcessWire; 

	

$form = $modules->get('FormTemplateProcessor');$form->template = $templates->get('book-now'); // required
$form->requiredFields = array('title', 'email', 'number','body');
//$form->email = 'your@email.com'; // optional, sends form as email
$form->parent = $page('template=book-now'); // optional, saves form as page
$form->render();  // draw form or process submitted form




?>

	<?php echo $form->render(); ?>

 

here is the error

bxhe56W.png

Posted

and this is definitely wrong


$form->parent = $page('template=book-now'); // wrong
$form->parent = $pages->get('template=book-now'); // should work

 

Posted

I just set this up on my dev install 3.0.96 with your code from above and it works.
Only thing I changed is $form->parent...

So it is hard to say what goes wrong on your end without seeing the complete template code.

EDIT: what does this say?

$form = $modules->get('FormTemplateProcessor');
var_dump($form);

And then right before your echo?

var_dump($form);
echo $form->render();


 

  • Like 1
Posted
43 minutes ago, gebeer said:

I just set this up on my dev install 3.0.96 with your code from above and it works.
Only thing I changed is $form->parent...

So it is hard to say what goes wrong on your end without seeing the complete template code.

EDIT: what does this say?


$form = $modules->get('FormTemplateProcessor');
var_dump($form);

And then right before your echo?


var_dump($form);
echo $form->render();


 

 

 

this error

Error: Uncaught Error: Call to a member function render() on null in C:\wamp64\www\mbs\site\templates\book-now.php:13

 

Posted

what does this say when you put it before everything else?

var_dump($modules->isInstalled('FormTemplateProcessor'));

 

  • Like 2
Posted
On 4/13/2018 at 5:54 PM, gebeer said:

what does this say when you put it before everything else?


var_dump($modules->isInstalled('FormTemplateProcessor'));

 

it solved my problem

thanks

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...