Friday, October 31, 2008

[jQuery] Re: [validate] problems with invalid-form.validate and remote rules

Thanks for tracking this down. Its now fixed in the latest revision.
Please let me know if it works for you.

Jörn

On Wed, Oct 29, 2008 at 10:01 PM, Àlex Corretgé <alex@corretge.cat> wrote:
> Hi Jörn,
>
> puting these files in the /validate/demo folder you can recreate the
> problem:
>
> - the field is filled when the form is loaded
> - the first submit, the form is cancel·led and the error is showed, but in
> $('#commentForm').bind('invalid-form.validate', function(e, validator)
> validator is undefined
> - the second submit, the form is cancel·led, the error is showed and the
> invalid-form.validate validator parm is a validator object.
>
> thanks for all
>
>
>
> --
> Atentament / Kind Regards
>
> Àlex Corretgé
> Serveis Informàtics Corretgé.com SLU
> http://corretge.cat/
>
> LinkedIn: http://www.linkedin.com/in/corretge
>
>
> 2008/10/27 Jörn Zaefferer <joern.zaefferer@googlemail.com>
>>
>> Can you provide a running example that I can look at? The more simplified
>> it is, the easier to debug.
>>
>> Jörn
>>
>> On Mon, Oct 27, 2008 at 12:39 PM, Àlex Corretgé <alex@corretge.cat> wrote:
>>>
>>> Hi Jörn,
>>>
>>> thanks for the quick answer.
>>>
>>>
>>> I fill the form with database data.
>>>
>>> If the data controled with a remote rule is erroneous and I never focused
>>> the field, when I submit the form, the form is cancelled but errorMap lenght
>>> is zero.
>>>
>>> the seccond time that I submit the form, errorMap has the errors
>>> correctly.
>>>
>>> $('#bpwcForm').bind('invalid-form.validate', function(e, lVal)
>>> {
>>> /**
>>> * procedim a deixar els tabs amb el color normal
>>> */
>>> for (var i in aTabs)
>>> {
>>> if (i > 0)
>>> {
>>> ajtabbar.setCustomStyle('ajt_'+aTabs[i],'#F4F3EE');
>>> }
>>> }
>>>
>>>
>>> var jjError = \"ERRORES en el FORMULARIO:\\n\";
>>> var jFirstTab = '';
>>> var jFirstField = '';
>>>
>>> //alert(gaValMsg.toString());
>>>
>>> for (var i in lVal.errorMap)
>>> {
>>> jCamp = i;
>>> jErrorMsg = lVal.errorMap[i];
>>> /**
>>> * controlem el tema de que sigui un error de
>>> * de formulari bpwc_jsForm
>>> */
>>> if (i == 'bpwc_jsForm' && jErrorMsg.substring(0,1) == '|')
>>> {
>>> jaMsg = jErrorMsg.split('|');
>>> //alert(jaMsg.toString());
>>> jCamp = jaMsg[1];
>>> jErrorMsg = jaMsg[2];
>>> }
>>>
>>> /**
>>> * carreguem el missatge d'error
>>> * i ens guardem a quin tab i quin
>>> * camp es el primer.
>>> */
>>> jjError = jjError + jErrorMsg + \"\\n\";
>>> ajtabbar.setCustomStyle('ajt_'+aFldTabs[jCamp],'red');
>>> if (jFirstTab == '')
>>> {
>>> jFirstTab = 'ajt_'+aFldTabs[jCamp];
>>> jFirstField = jCamp;
>>> }
>>>
>>> }
>>> ajtabbar.setTabActive(jFirstTab,true);
>>> document.getElementById(jFirstField).focus();
>>> ajtabbar.setCustomStyle(jFirstTab,'red');
>>> alert(jjError);
>>>
>>> });
>>>
>>>
>>> Thanks for all
>>>
>>>
>>> --
>>> Atentament / Kind Regards
>>>
>>> Àlex Corretgé
>>> Serveis Informàtics Corretgé.com SLU
>>> http://corretge.cat/
>>>
>>> LinkedIn: http://www.linkedin.com/in/corretge
>>>
>>>
>>> 2008/10/24 Jörn Zaefferer <joern.zaefferer@googlemail.com>
>>>>
>>>> Fixed!
>>>>
>>>> You're welcome to test it before the next release, you can find the
>>>> latest revision here:
>>>> http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/
>>>>
>>>> Jörn
>>>>
>>>> On Thu, Oct 23, 2008 at 10:49 PM, Àlex Corretgé <alex@corretge.cat>
>>>> wrote:
>>>> > Ok Jörn,
>>>> >
>>>> > issue created
>>>> >
>>>> > http://dev.jquery.com/ticket/3516
>>>> >
>>>> > thanks for all
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> > Atentament / Kind Regards
>>>> >
>>>> > Àlex Corretgé
>>>> > Serveis Informàtics Corretgé.com SLU
>>>> > http://corretge.cat/
>>>> >
>>>> > LinkedIn: http://www.linkedin.com/in/corretge
>>>> >
>>>> >
>>>> >
>>>> > 2008/10/22 Jörn Zaefferer <joern.zaefferer@googlemail.com>
>>>> >>
>>>> >> Apart from the fact that this event needs to get exposed as an
>>>> >> option,
>>>> >> its also a bug that it isn't triggered by the remote method. Could
>>>> >> you
>>>> >> file a ticket for this? http://dev.jquery.com/newticket (requires
>>>> >> registration)
>>>> >>
>>>> >> Thanks!
>>>> >>
>>>> >> Jörn
>>>> >>
>>>> >> On Wed, Oct 22, 2008 at 10:47 AM, corretge <alex@corretge.cat> wrote:
>>>> >> >
>>>> >> > Hi, I try to show a list of errors in an alert box when the form is
>>>> >> > cancelled by jQuery Validator.
>>>> >> >
>>>> >> > Surfing the web I see that I can use invalid-form.validate like
>>>> >> > this:
>>>> >> >
>>>> >> >
>>>> >> > $('#bpwcForm').bind('invalid-form.validate',
>>>> >> > function(e,
>>>> >> > validator)
>>>> >> > {
>>>> >> > var errors = validator.numberOfInvalids();
>>>> >> > alert('ERR ' + errors);
>>>> >> >
>>>> >> > });
>>>> >> >
>>>> >> >
>>>> >> > but this function is NOT executed when a submit form is cancelled
>>>> >> > by a
>>>> >> > remote rule.
>>>> >> >
>>>> >> > any suggestion or work-arround?
>>>> >> >
>>>> >> > thanks
>>>> >> > Àlex Corretgé
>>>> >> >
>>>> >
>>>> >
>>>> >
>>>
>>>
>>>
>>
>
>

No comments: