Open mrb260478 opened 11 years ago
may be it's trouble in your PHP or ASP code, becouse if you click "save" and validation dont show errors, the form is sending data 100%!
You can see this in Chrome browser, press Ctrl+Shift+I look at "network" tab.
Open your form and try to send a form ... you can see a Request(sending data and other info).
I had used Opera Developer Tool to monitor if any request is fired when Save Button is clicked. Nothing happens. Just the ajax validation is fired again. Form is not submitted.
Manish B
PLEASE HELP
please someone can help me ... i have a fiel in my database wich is unique, so i have to validate that, but how can i show a message with this "this username is already taken"; please help me
Hi, I use a Form Validation Engine 2.6.2, jQuery plugin by Cedric Dugas, look at https://github.com/posabsolute/jQuery-Validation-Engine. When You used that JS code You can add a new rules in a file.
function checkIsSet(field, rules, i, options){
... field.value to some ajax code for checking username ...
if(false){
return options.allrules.validate2fields.alertText;
}
}
and in form field you need to add a current rule
<input name="username" class="validate[required,funcCall[checkIsSet]]" value="" />
also isset ajax[]
validation method but I don't use it.
I don't know if they've worked it out yet, but there were a good number of AJAX issues over on the the Validation Engine forum.
I've had more success enforcing the unique constraint (example in MySQL, example for MSSQL) on the database table itself. It's smart to have it enforced on the db-level anyways. If a user attempts to submit a dupe value, the database will sqwawk and you can catch that inner exception and expose it to the end-user. If you happen to be using MVC and entity framework, here is the catch clause which will do just that...
catch (Exception ex) { // // In a perfect world, we'd check the for duplicate values BEFORE bouncing them off the DB. // But EF 5.0 doesn't have a clean method for that. // We're left with passing possible dupes on, and exposing SQL error messages to the user. // http://blog.wassupy.com/2012/10/catching-unique-key-constraint.html // var sqlException = ex.InnerException.InnerException as SqlException; string message = string.Join("", sqlException.Errors.OfType().SelectMany(x => x.Message)); if (sqlException != null && sqlException.Errors.OfType ().Any(se => se.Number == 2601 || se.Number == 2627 /* PK/UKC violation */)) { return Json(new { Result = "ERROR", Message = "Are we sure that we aren't saving a duplicate value?
The database wouldn't take it. Here is what she said:
" + message }); } else { return Json(new { Result = "ERROR", Message = ex.Message }); } }
If your server-side language is php and your db is mysql, look here for an example.
With that catch in place, instead of the generic "There was a problem communicating with the database error" you will get a more descriptive error which atleast helps explain to the end user why they can't submit a dupe value. Not as slick as client-side AJAX validation, but it DOES work.
I am also having the same issue.Ajax unique validation is working but after that the form is not submitting. Please help
First of all, Thanks for this Nice Plugin.
I have used this plugin with validation engine.
I am using ajax field value validation.
validation engine's ajax validation works ok after which when i click on save button the form (data) is not saved.
Is their some problem with ajax in validation engine or in jtable.
Kindly help.
Manish B