0

I am using Kohana 3.2 on a project that I am working on. I am new to this framework. While searching for the documentation for validation I found this page :

http://kohanaframework.org/3.1/guide/kohana/security/validation

In that page they are using built in helper functions for generating the form. I followed that tutorial but I was surprised to see even after using the form helper functions I had to to loop through the errors array and display the errors one by one. This is very much unlike Yii which displays the error messages automatically next to the form fields and also applies basic javascript validation intelligently.

Hence my question what is the point of using the form helper functions in Kohana framework ? Or is there some other purpose I am missing out ?

hakre
  • 193,403
  • 52
  • 435
  • 836
ajaybc
  • 4,049
  • 7
  • 44
  • 57
  • This is unrelated, but why are you switching from Yii to Kohana? – Narretz May 15 '12 at 07:27
  • @Narretz I just did a small project in Yii. I felt it was a bit bloated and difficult to learn. Heard Kohana is lighter and very easy to learn. So trying it out. – ajaybc May 15 '12 at 08:00

2 Answers2

6

It's completely optional, they're there just to 'easen' form elements creation, so that you don't have to escape each attributes HTML chars manually etc. You can add a function to display errors like echo Form::errors($errors, 'field_name') if you want.

You'll learn that Kohana doesn't do anything 'magical' by itself, it's all up to the developer to decide. IMO that's a strength.

Kemo
  • 6,942
  • 3
  • 32
  • 39
  • Thanks. The documentation is absolute BS. Glad there are people like you out there to help. – ajaybc May 15 '12 at 08:01
1

The only reason Kohana 3.2 has form helpers is because they were in prior and were retained to maintain compatibly. Actually it is recommended that you don't use Form helpers, as there are no needs for it.

You can always log in into IRC #Kohana and ask the devs. Most will agree.

scoutman57
  • 13
  • 6