[validate] problem with a "remote" rule
Hi, i'm having a problem with a remote rule.
here's the code:
- $().ready(function() {
- validation = $("#inserisci_promozione").validate({
- rules: {
- C_BNC_ABI: {
- required: true,
- remote: {
- url: "main.app",
- data: {
- FUNCTIONID: "ValidaAbi",
- C_CAB: function() { return $("#C_BNC_ABI").val(); }
- } ,
- success: function(data) {
- if (data == true){
- loadSelect($("#C_BNC_ABI").val());
- }
- }
- }
- }
- },
- messages: {
- C_BNC_ABI: {
- remote: "ABI non censito"
- },
- }
- });
- });
The remote call is a jsp that checks a database and correctly returns true or false.
The "success" clause of the remote call parses the results and if the remote check returned true it populates a dropdown menu with another ajax call.
The problem is that the validate part of the script quits working if the success clause is present.
The remote call works (i sniffed it) and correctly return true or false. But the validate() ignores the result and doesn't show the error message if the answer is false.
If i change the success clause content to even a simple alert it still doesn't work.
If i delete the success clause everything works fine.
Any idea why this happens?
Thanks in advance!
Marcello