Welcome Guest, Not a member yet? Register   Sign In
Challenging validation question...

Here is the situation, I have forms that I do not, ahead of time, know what they will contain (we consume a service which customizes the forms according to the client's desires for their specific form submission page). I receive all of the information via XML and construct the form, validation and all, and post this information.

Everything is functionally working, I am able to create the form, able to error check using the validation and able to report errors as the forms aren't filled out correctly.

Now the issue, the error message is one section on the top and the clients want the error messages next to the form field elements that aren't filled out correctly.

I've been trying to come up with a way to accomplish this as the CI way is to do this:

<?=$this->validation->username_error; ?>

However, I don't know what the name of the field is, it changes with the client's request, so how can I do this?

The fields and rules assignments are easy because they allow me to put a string value in the assignment and all is well. The single error doesn't (and I've tried to concatenate the string for the end of the validation call and it doesn't work)

Any help would be greatly appreciated (as the site goes live shortly and I've got to fix other fires at the moment). Thank you!

In a similar situation, our answer was found in PHP's curly braces, which literally mean "evaluate what's inside the curly braces". http://us2.php.net/manual/en/language.va...riable.php

So, get the field name from your XML and put it into $field_name. Then, you should be able to reference

Of course, apologies if I over-simplified your question and didn't help...

THANK YOU!!!! worked like a charm, you nailed exactly what I needed to have for this.

Theme © iAndrew 2016 - Forum software by © MyBB