+ Start a Discussion
simhasimha 

Click Next button Going to next page and again comming back to same page in Mozilla Firefox

Hi I have a small problem in Visual Force development

 

Im creating an application in which I used Tabpanel in which each tab contains Some fields  Where when the user enters the value and click Next Button It must check the Values for validation and Displays an error message if any thing is wrong and if every thing is Correct it should Redirect To Next Page .  For this Validations I used Java Script in the Visual Force Code and for navigate to next Page i used Apex Code . Where in java script If everything is Correct im calling the action function to navigate to the Next page . Every thing is going correct But at the time to navigate to next page its going to next page and again coming back to the previous page for 2 to 3 times after several button clicks on NEXT BUTTOn its going and staying in the next page. For other tabs where i dint givn any javascript its directly redirecting to next page with out any problem.

 This Problem is occuring in Mozilla firefox but its navigating corectly some times in IE and Opera

Here is the Code VF code

 

 


           <apex:tab id="PDetails" label="Personal Details" title="Personal Details" disabled="{!istab1disabled}">

           <apex:pageBlockSection title="Personal Details">
                    <apex:form >    

                         <p><apex:outputLabel value="Date Of Birth"/></p>
                         <apex:inputField value="{!Application__c.Date_Of_Birth1__c}" id="dobid" />
                         <script>
                             function check() {
                                var nation = document.getElementById('{!$Component.nationality}').value;
                        
                                if(nation!="INDIAN")
                                {
                                    alert("U MUST BE AN INDIAN");                                   
                                }         
                                else
                                {
                                    nextpage();
                                }
                            }
                         </script>

                        <p><apex:outputLabel value="Nationality"/></p>
                        <apex:inputField value="{!Application__c.Country_Of_Citizenship__c}" id="nationality"/>
                       <apex:actionFunction name="nextpage" action="{!enabletab2}" reRender="maintab"/>
                        <Apex:commandButton value="NEXT"  onclick="check()" reRender="maintab" />

                        <Apex:commandButton value="PREVIOUS"  action="{!enabletab0}" rerender="maintab" />
                        <apex:commandButton value="Cancel"  action="{!nothing}"  />                       
                   </apex:form>
               </apex:pageBlockSection>
            </apex:tab>   

             <apex:tab id="CDetails" label="Contact Details" title="Contact Details" disabled="{!istab2disabled}">
                <apex:pageBlockSection title="Mailing Address">
                    <apex:form >

                            ................

                              ................

                     </apex:tab>

 

 

Apex CODE

 

 

public void enabletab1()  
{
selectedtab = 'Personal Details';
}
public void enabletab2()
{
selectedtab = 'Contact Details';
}

public void enabletab3()
{
selectedtab = 'Education information';
}