Archive for May 2008

Sage CRM – Tab is not selected when navigating multiple Custom ASP pages

 

The tab for a custom ASP page will not stay highlighted when you jump to another asp page within. For Example: The screen shot below shows a custom asp page called "Logins". The tab is selected within that custom asp page but when you hit new it calls another asp page.

Loginstabselected

loginstabnotselected

You will notice that the tab is not selected when the other asp page is called within the first asp page by pressing the new button.

There are a few ways to handle this problem.

  1. You can just create a tab group and just call it within get page so it goes to it’s own tab group like Marketing.
    Response.Write(eWare.GetPage("YourTabGroup");

    tabgroup

  2. You can handle multiple views within 1 asp page so the tab is selected amongst the other tabs. The code below is an example of using if statements to handle different views and actions.
    <!-- #Include file = "accpaccrm.js" -->
    <%
    if(Request.QueryString("mode") == 'new')
    {
        varCancelButton = eWare.Button("Cancel","cancel.gif",eWare.Url("login.asp"));
        if(eWare.Mode == View)
        {
            eWare.Mode = Edit;
        }
        varLoginNew=eWare.GetBlock("LoginEntry");
        varThisCompany = eWare.GetContextInfo("Company","comp_companyid");
        LoginNew.Title = eWare.GetTrans("tabnames","logins");
        LoginNew.AddButton(CancelButton);
        varmyRecord = eWare.CreateRecord("logins");
        myRecord.log_companyid=ThisCompany;
        eWare.AddContent(LoginNew.Execute(myRecord));
        if(eWare.Mode == Save)
        {
            Response.Redirect(eWare.URL("login.asp"));
        }
    }
    else if(parseInt(Request.QueryString("log_loginid")) > 0)
    {
        varCancelButton = eWare.Button("Cancel","cancel.gif",eWare.Url("login.asp"));
        LoginNew=eWare.GetBlock("LoginEntry");
        LoginNew.AddButton(CancelButton);
        LoginNew.Title = eWare.GetTrans("tabnames","logins");
        LoginNew.DisplayButton(Button_Default) = true;
        LoginNew.DisplayButton(Button_Delete) = true;
        varintRecordId = eWare.GetContextInfo("company","comp_companyid");
        ThisLoginId=Request.QueryString("log_loginid");
        varmyRecord = eWare.FindRecord("logins","log_loginid="+ThisLoginId);
        eWare.AddContent(LoginNew.Execute(myRecord));
        if(eWare.Mode == PostDelete)
        {
            Response.Redirect(eWare.URL("login.asp"))
        }
        if(eWare.Mode == Save)
        {
            Response.Redirect(eWare.URL("login.asp")+"&log_loginid="+myRecord.intRecordId);
        }
    }
    else
    {
        varThisCompany = eWare.GetContextInfo("Company","comp_companyid");
        varurl = eWare.Url("login.asp")+ "&mode=new";
        varnewButton = eWare.Button("New","new.gif", url);
        varLogins = eWare.GetBlock("LoginList");
        Logins.AddButton(newButton);
        varArg = "log_companyid="+ThisCompany;
        eWare.AddContent(Logins.Execute(Arg));
    }
    Response.Write(eWare.GetPage());
    %>