If tested the validation. So the PHP controller seems to work. I got the correct error message “Some fields do not contain valid data.”
I thought I have to replace it with my own value… But thanks for that answer
With my forms, even on a page with a single ajax form this code dosen’t work. It returns a PHP Fatal error: Call to a member function hasError() on null…
I just uploaded the page to my webserver and voila: here it works great. I don’t know why it dosen’t work locally.
So I think i can close this thread, resp. mark as solved.
Somehow it doesn’t work properly.
If I use the new JSON object from @mzur with json_encode() it works great on my local develop environment.
But as soon as I upload the hole site I get the following response (HTML request) if some required fields are empty:
<b>Warning</b>: array_filter() expects at most 2 parameters, 3 given in <b>...site/templates/support-send.php</b> on line <b>9</b><br />
<b>Warning</b>: array_keys() expects parameter 1 to be array, null given in <b>...site/templates/support-send.php</b> on line <b>9</b><br />
{"success":false,"message":"Bitte f\u00fcllen Sie alle ben\u00f6tigten Felder aus.","errors":null}
and if every field is filled correctly:
<b>Warning</b>: array_filter() expects at most 2 parameters, 3 given in <b>...site/templates/support-send.php</b> on line <b>9</b><br />
<b>Warning</b>: array_keys() expects parameter 1 to be array, null given in <b>...site/templates/support-send.php</b> on line <b>9</b><br />
{"success":true,"message":"Vielen Dank, das Formular wurde gesendet.\nDer Logeintrag wurde erfolgreich angelegt.","errors":null}
and the form gets sent.
Why does it work locally but not on the live server?
I’m only trying to set up a single ajax form with Uniform, but keep running into the same error for using ARRAY_FILTER_USE_KEY because I’m not running PHP version 5.6. My web host won’t allow me to run higher than 5.5.21, how can I fix this with my version of PHP?
i am trying to achieve a input field using uniform with ajax. the ajax submit stores the data online. then the form should be able to send again. store, send again, store,… creating another entry everytime.
my problem is that once the form is submitted the token is no longer valid. how should i fix this? can i get a new token the json response and update my form > _submit value?