Welcome Guest, Not a member yet? Register   Sign In
form validation : not quite finished
#1

[eluser]soupdragon[/eluser]
Am I the only one who thinks that the new form validation is not really finished ?

For example great idea i can have my rules in a seperate config file such
array(
'field' => 'username',
'label' => 'lang:username',
'rules' => 'required'
),

So i have actually defined the label - but can i use it in the form itself ?
seems to be no that is only for the error messages ?

Also there is the repopulating the form
i should do this set_value('field name')

okay nps BUT in my controller i am having to remember to use $this->input->post(''field name'); because in the controller set value does not work.

Is it just me or does anyone else think the same ?
#2

[eluser]xwero[/eluser]
I have to agree with you. The main problem i have i that some of the functions of the form helper are depending on the form validation class. I think this is a bad way to go because

- none of other classes are depending on a helper
- the functions that are depending on the form validation class don't generate html.

In the feature request section i started a thread about this 'problem'.

As far as your use of a label function goes i can follow your thoughts about adding the same information on two places but the same goes for the field. You still need to add the field to the label function so you could use language helper.
Code:
lang('username','username') // outputs <label for="form_item_id">language_key</label>

And again we have an helper function that has a functionality that is not expected. The EL developers should add the same lang: prefix to the label function for the visible part. IMO there is only a slight relation between the label and the validation so i don't think the library helper needs a label function
Code:
// form_helper
form_label('lang:username','username');
// form_validation_helper
form_validation_label('username');


Another reason why i think the library feels not finished is the fieldname as array handling. i don't use it a lot myself but i did some testing during the time the library was only in the SVN trunk and i didn't see any changes when the 1.7 release became official.




Theme © iAndrew 2016 - Forum software by © MyBB