Jump to content

make pw variables available in custom script


helmut2509
 Share

Recommended Posts

I have a custom script in which I want to validate the contents of input fields.

however it seems, that $sanitizer and $input are not available there, I get this error message:

"Trying to get property of non-object".

So how can I make those variables available in my custom script?

Link to comment
Share on other sites

I tried this:

 $sanitizer = wire('sanitizer');

 $input = wire('input');

But at using $input I get the error message:

Trying to get property of non-object

...and at using $sanitizer I get :

..Call to a member function text() on a non-object

Link to comment
Share on other sites

Can you post your code? 

in the meantime I found out:

 $sanitizedInput = wire('sanitizer')->text(wire('input')->post->$fld);

...works, but

$input = wire('input');
$sanitizer = wire('sanitizer');
.......

$sanitizer->text($input->post->name);

...does not work

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...