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).length>0)
  $(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.

Reply via email to