Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:59:42+00:00 2026-06-13T05:59:42+00:00

So I have a dropdown context box, which I use to select which item

  • 0

So I have a dropdown context box, which I use to select which item I am going to be working with.

Now everything seems to be working on all browsers except Safari. I have a type function that works fine in safari if you focus on the box and type the name in and hit enter. However my issue is with the mouse click. If I select an item from the dropdown and click it, the postback doesn’t work until I hit enter on the keyboard.

Here is my .ascx.cs file

...
if (cboContext.Visible)
    {
        string postBackFunction = "function contextPostback() {\n"
        + "var newValue = document.getElementById(\"" + cboContext.ClientID + "\").value;\n"
        + "if (newValue != " + cboContext.SelectedValue + ") " + Page.ClientScript.GetPostBackEventReference(cboContext, "") + ";\n}";

        Page.ClientScript.RegisterClientScriptBlock(typeof(string), "contextPostback", postBackFunction, true);

        if (Request.UserAgent.ToLower().IndexOf("chrome") > -1)
        {
            cboContext.Attributes.Add("onkeypress", "if (typeAhead(event,'" + cboContext.ClientID + "') == 1) contextPostback();");
            cboContext.Attributes.Add("onclick", "contextPostback();");
        }
        else if (Request.UserAgent.ToLower().IndexOf("safari") > -1)
        {
            cboContext.Attributes.Add("onclick", "contextPostback();");
            cboContext.Attributes.Add("onkeypress", "if (typeAhead(event,'" + cboContext.ClientID + "') == 1) contextPostback();");
            cboContext.Attributes.Add("onkeydown", "if (typeAhead(event,'" + cboContext.ClientID + "') == 1) contextPostback();");
            cboContext.Attributes.Add("onkeyup", "if (typeAhead(event,'" + cboContext.ClientID + "') == 1) contextPostback();");
        }
        else
        {

            cboContext.Attributes.Add("onkeydown", "if (typeAhead(event,'" + cboContext.ClientID + "') == 1) contextPostback();");
            cboContext.Attributes.Add("onclick", "contextPostback();");
        }
    }

Here is the typeAhead() function

function typeAhead(e, nextFocus) {

//don't trap Ctrl+keys
if ((window.event && !window.event.ctrlKey) || (e && !e.ctrlKey)) {

    // timer for current event
    var now = new Date();

    ....
    if (inputBuffer.accumString == "" || now - inputBuffer.last < inputBuffer.delay) {
        //check for browsers
        var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
        var is_safari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
        // make shortcut event object reference
        var evt = e || window.event;
        // get reference to the select element
        var selectElem = evt.target || evt.srcElement;
        // get typed character ASCII value
        var charCode = evt.keyCode || evt.which;
        // get the actual character, converted to uppercase
        var newChar = "";
        // get reference to the actual form selection list
        // added cross browser fix to enable the context switcher to work properly
        if (is_chrome) {
            var selection = document.getElementById("ctl00_ContextSwitch1_cboContext").selectedIndex;
        }
        else {
            var selection = document.getElementById(nextFocus);
        }
....

Now I have a section in the typeAhead for the chrome browser, but everything I try for safari doesn’t seem to allow me to use the mouse click to select an item.

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:59:43+00:00Added an answer on June 13, 2026 at 5:59 am

    simple fix. safari recognizes onchange so once I added that, it worked fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have dropdown-Lists which have a lot of elements (>1000). When I select one
I have dropdown menu..which is dynamic.. How can get value of the last item
I have a dropdown and when I select an item from it, I want
I have a dropdown navigation panel and below it a div with context. Before
I have this dropdown. I need clone for my other dropdown lists: <select name=general>
I have a button in android which on clicking produces an alert box. But
$(#home-shop-first).hover(function(){ $(#first-button-box).slideToggle(); }); This works to display a dropdown box, but now I need
I have been trying to find out how to populate a dropdown box in
I have the following code select box div: Make:<br> <select name=Make> <option value =
I have a select box with 3 items that is positioned over an input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.