[jQuery] Re: Validation and Tabs plugins compatibility

2009-03-20 Thread Jörn Zaefferer

I've released an update to the validation plugin, including a demo
showing integration with jQuery UI tabs:
http://jquery.bassistance.de/validate/demo/tabs

Jörn

On Tue, Jul 8, 2008 at 10:56 PM, peace4theapes peace4thea...@gmail.com wrote:

 Diego,

 Thanks for the reply. I tried this idea but it threw up another
 interesting problem. I was wondering if you could throw some light on
 it.

 When the validation plugin adds an error class, it does not remove it
 once the form is validated. Therefore when I switch to the tab with
 the error class, the same tab is selected every time.

 Also, do you know how I could call this small (tab changing) function
 from the validate plugin? Something like form.validate({onerror:
 changetabs()}

 Thanks again,
 -P



[jQuery] Re: Validation and Tabs plugins compatibility

2008-07-08 Thread peace4theapes

Diego,

Thanks for the reply. I tried this idea but it threw up another
interesting problem. I was wondering if you could throw some light on
it.

When the validation plugin adds an error class, it does not remove it
once the form is validated. Therefore when I switch to the tab with
the error class, the same tab is selected every time.

Also, do you know how I could call this small (tab changing) function
from the validate plugin? Something like form.validate({onerror:
changetabs()}

Thanks again,
-P


[jQuery] Re: Validation and Tabs plugins compatibility

2008-07-03 Thread Diego A.
Hi,

This is just an idea (which I haven't checked) but since you have JS
experience I'm just gonna throw it at you.

The validation plugin adds an 'error' class to all problem fields. You could
very quickly loop through each tab, look for an error and (if found), change
the focus to that tab. something like...

$('#my-tabs  div').each(function(i){
 if($('.error', this).length0)
  $(this).tabs('activate', i);
});

I'm not sure that 'activate' is the right action for the tabs plugin, you'll
have to check the documentation...

Cheers,
Diego A.

2008/7/3 peace4theapes [EMAIL PROTECTED]:


 Hello all,

 I am just switching to JQuery from prototype and am trying to use the
 Validation and Tabs plugins for JQuery. Here's my problem:

 I have one form tag in which I have my tabs container. Using a dynamic
 language I am creating multiple tabs for user chosen data, say states.
 So if the user has chosen 5 states, there are five tabs with the same
 form fields with the _statename appended to the end of the field
 name.

 So, if the user enters data, validates the form and click on continue
 nothing happens as the user has not touched the other tabs. But, the
 user doesn't know about this and it is a confusion. Is there a way to
 select the right tab depending on which tab the validator throws an
 error in?

 Any help would be greatly appreciated.

 I am using the following code:



 script type=text/javascript
 $(function() {

 $('##tabs_container  ul').tabs({ fx: { opacity:
 'toggle' } });
 });
 /script

 script type=text/javascript

 $().ready(function() {

 $(##general).validate({
 rules: {
cfloop list=#stateslist# index=sta
cfset sta = ReplaceNoCase(sta,' ','','All')
products_#sta#: required
osda_#sta#: required,
/cfloop

 },
 messages: {
cfloop list=#stateslist# index=sta
cfset sta = ReplaceNoCase(sta,' ','','All')
products_#sta#: Choose product;
osda_#sta#:  Please choose YES OR NO.
/cfloop

 }
 });


 });

 /script


 Thanks
 -P




-- 
Cheers,
Diego A.