How to show single form validation error message for multiple form fields in codeigniter - forms

I have a simple form which has only two(email, password) fields. I'm using codeigniter's form validation library to validate that form. And it's working fine, but not the way I wanted to.
I want to show only one error message when email or password field empty. or when both fields are empty. not two error messages for each fields.
How can I do that in codeigniter using it's form_validation library.

Use form_error() function http://www.codeigniter.com/user_guide/libraries/form_validation.html look up Showing Errors Individually

Related

How to validate wicket form sequencly

I am new to wicket framework. currently i have a task to validate the form fields one by one (sequence). but By default Wicket shows error messages together in a one place in the form. I want the field to be validated sequential is there any components ? Or Please guide me in the right direction what i should do ?
For EX:
if i consider LoginPage which contains username,password with out entering anything if i submit the form . that should show first field username required even password not entered also. once i fill username next it should check password entered or not so like this sequential validation possible?
You can use a ComponentFeedbackMessageFilter to show feedback messages for each component separately.
Please read "Displaying feedback messages and filtering them":
https://ci.apache.org/projects/wicket/guide/6.x/guide/forms2.html#forms2_2

Is there a way to remove field value using model in CakePHP?

I'm developing an application in CakePHP 2.7 and I have a form where that sends off an Ajax request from a file input and returns some information. This information is then stored inside a hidden form field.
I have a custom validation rule that checks against the hidden field and another to see if both have been submitted as the system can only handle one. When the validation rule returns false it flags up an invalidate message to notify the user of the issue. However now I am left with an issue where the hidden field still contains a value and so does the other field the user filled out but I can't remove the value from the hidden field.
Is there any way I can remove the value from the hidden field inside the model?
I have looked at this question on StackOverflow but it wasn't successsful in helping and dates back to an earlier version of CakePHP based on the date of the question.

Translate the text error required fields in a form with Symfony2

I'm developing an application with Symfony2 and I try to translate texts form validation (required). Validation is done by the browser and I get eg "Veuillez renseigner ce champs" I wish I could translate the customer or switch also navigation.
My forms are made with buidform.
Thank you in advance for your help
Olivier
If you are referring to the browser validation raised when a field has an attribute required, this does not depend on symfony. I'm not sure you can set a language for these messages as they are generated by the user's browser.
A solution for you might be to disable browser validation (ie set required to false in your formBuilder fields) and rely on Assertions in you entities whose messages you can customise, you'll find more about this here.

Symfony 2 form validate

I have a simple form without a entity that I use to send emails. Now I was testing in firefox and if I leave a field empty I will get a message. But now if I open the same form in Safari (that ignores required proprty) I won't get any message. The form->isValid() returs true even when I leave all fields blank...
How to validate this?
The in-browser validation is just a time saver to avoid a request to a server when a field is blank, but it's not a proper validation because it can be disabled on the browser level. You still should validate on the server side.
See this section — you need the NotBlank constraint.

Does using the action class of different module causes change in header during form submission?

I have problem with form submission to a action of different moudule, say e.g I have a module called "mymobile" from I am calling a action in module "register" which will process the registration, if there is any error in form I am setting the error messages and forwarding to "mymobile" module's page from where I called the action of "register", so it is modifying the header and my Japanese text is getting converted to some junk. Is there any way I can show error messages on my form without change of text? Any alternative for $this->forward() method? I am using symfony 1.1 and I tried $this->rediect() it will refresh the page.
Thank you in advnace