I think its easy to create form via only html and do not use form helper. What is the advantage of using form helper?
问题:
回答1:
Using form helper you obtain much benefits:
- Activation for xss/csrf protection
- Sanitize post data
- Multilanguage labels
- Validation
- Unique db validation
- Easy form modification
- Easy set form fields value
I recomend to you see:
Form validation
Form helper
Lang helper
回答2:
I've found it helpful primarily for two reasons:
form_open()
can do a lot for you, like resolving the action URL, adding CSRF hidden fields, etc. If you decide later on that you want to enable/disable CSRF, it's a simple boolean switch if you used the function religiously.form_dropdown()
is a lifesaver, particularly if you want to repopulate an existing value, or provide a default. I can think of very few times when it's easier to write this logic manually than provide an array of data and a default.
Beyond that, the other functions are gravy and depend on how you're using validation and such.
Because it's a helper, only use it if it helps you.
回答3:
They help you make forms. If you can do it, do it, I find any auto generating programs to be more harm then help. This is because they often use cheap styling to get what they want. Essentially they will never opt for the best solution rather the easiest.
Also, please read the FAQ as I don't think the community will like this kind of question.
回答4:
I think the main benefit to using the form helper is that it can help with validation rules, sanitizing inputs, and adding protection from XSS.