Hi,

I've try to use remote method and not work.


There are the parameters


<script type="text/javascript">
  $(document).ready(function(){


    var validator = $("#formcode").validate({
        rules: {
         codigo: {
            required: true,
            minlength: 3,
             remote: "valcodigo.php"
            }
         },
              errorPlacement: function(error, element) {
                error.insertAfter(element);
        },


        messages: {
               codigo: {
               remote: jQuery.format("El código {0} ya existe")
               }
        },
        errorClass: "errores"
       })
  })
</script>


The form

<div id="form">
<form id="formcode" name="formcode" method="post" action="<? echo
$PHP_SELF?>?p=<?echo $modulo?>&acc=grabar" class="cmxform">
        <fieldset>
         <label for="codigo">Código</label>
          <input type="text" name="codigo" id="codigo" class="input" /><br />
</fieldset>
<input class="submit" type="submit" value="Grabar" />
</form>

The remote script
<?php
$request = trim(strtolower($_REQUEST['value']));
$codigo= array('A1234','B1234');
$valid = 'true';
foreach($codigo as $cod) {
        if( strtolower($cod) == $request ) {
                $valid = 'false';
        }
}
echo $valid;
?>


required and minlenght work fine but remote don't

I've download the entire "Milk" demo and I've copy it in my local
server and remote method don`t work too.

Anybody help me???


Thanks

Adrian

Reply via email to