Welcome Guest, Not a member yet? Register   Sign In
Form validation form_error() custom message?

I have a table with basically inputs on multiple rows. Each row has array forms named like:

itemno[], upc[] etc.

Because there are a lot of fields across a few columns it's good to be able to tell the user exactly where the error is in a row, which I figured I could do with form_error. But the error message is much too long to fit in the cell with the field.

I wondered if I could just see if the field had an error or not and if it did, make an asterisk appear etc? Short of running the function and checking it doesn't return an empty string I can see it's not possible to do this with form_error().

Is there an alternative?

I know it doesn't make sense to list all the errors because then the user doesn't know which row the error is indicating there's a problem with, but it also doesn't make sense to just change the error string to an asterisk purely so when it appears in the cell it looks better.

Hope I made sense!


Hmm it seems form_error doesn't work like I expected either. Unlike set_value() which seems to be able to set the correct value back even for array'd form submissions, form_error() just gives an error in every case if any one item within it is invalid. Is there a way around this?

Theme © iAndrew 2016 - Forum software by © MyBB