Today I discovered, how to add custom form validation and I missed a response for invalid inputs. So I wrote some code to add a response with error messages here.
If this pull request will be merged, you can use it this way:
create a form in Cockpit and name it contact
create file /config/forms/formname.php - replace formname.php with contact.php
Today I discovered, how to add custom form validation and I missed a response for invalid inputs. So I wrote some code to add a response with error messages here.
If this pull request will be merged, you can use it this way:
/config/forms/formname.php
- replace formname.php with contact.phpsimple content of contact.php:
Response in Postman
after sending
{"form":{"name":"","message":"blabliblub"}}
:a more complicated example (maybe I'll write an addon soon, but maybe not...):
send json via Postman:
{"form":{"name":"Raffael","message":"blabliblub", "confirm":"1","mail":"+49 1234 56789012"}}
response:
content of contact.php: