Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 12, 20177 yr I have a couple of questions related to Form Helper classes. First, is there a place I can get extensive documentation for all of the Form Helper classes, options parameters, etc? The documentation only seems to display limited information. Is the validation done with Form Helper classes done server side? Do I need to preform custom validation checking just for simple things such as length, blank inputs when marked as required, etc? Is the validation arguments in the $options constructor done server side as well? What about string sanitizing? Do I need to do that as well, or is the data returned from $form->values() already sanitized and ready to be used with database queries? What are all the $options parameters I can use for validation? Is there a Form Helper class for reCaptcha? I managed to use \IPS\Helpers\Form\Captcha without error but nothing actually displays in the form.
April 12, 20177 yr Quote For all of the available classes, look at the files in the system/Helpers/Form/ directory. The values acceptable for $options are documented in the source code for each. Be aware that some extend others (for example CheckboxSet extends Select, and has the same $options). What you're asking about validation is also documented on that page. There are some basic validation done client side, such as checking for empty required fields, if a Number field holds a numeric value (and if it's within a specified range). The same things are of course checked for on server side. The value you get from a Form Helper should be ready to use with Active Record (Item, Node, Comment, Review, etc), not 100% if you're doing a manual query. Using Captcha in a form should be as simple as this: $form->add( new \IPS\Helpers\Form\Captcha );
April 12, 20177 yr Author Awesome, thank you so much! Knowing where the source code is for those classes helped a lot.
April 12, 20177 yr You can easily tell where the source file is located just by looking at the namespace and classname
Archived
This topic is now archived and is closed to further replies.