Welcome Guest, Not a member yet? Register   Sign In
Form validation, get label
#1

[eluser]Mat-Moo[/eluser]
Is there a way to use you field name via the form_validation unit (or helper) to get the "Label" for it? Like $this->form_helper->Get_Label('field')?
#2

[eluser]xwero[/eluser]
You can create your own function for this but be aware of the lang: prefix functionality of the label field.
#3

[eluser]Mat-Moo[/eluser]
Any clues on this? I know I can create a function, but I don't know where the data is...
#4

[eluser]Mat-Moo[/eluser]
Anyone help me on this?
#5

[eluser]xwero[/eluser]
the data is in the _field_data[$field]['label'] Form validation class variable. You can extend the class with a label method and add a label method to the form helper that takes care of the html generation.

But if you store all your labels in language files you can use the language helper to generate the html. With this approach you don't need to extend the framework and you don't have to change code if more languages are needed.
#6

[eluser]Mat-Moo[/eluser]
Thanks




Theme © iAndrew 2016 - Forum software by © MyBB