jQuery UI Widgets Forums Lists DropDownList Combo Box Auto Focus

This topic contains 6 replies, has 2 voices, and was last updated by  RavikumarR 12 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Combo Box Auto Focus #11351

    RavikumarR
    Member

    I am placing Combo in my form . in this Combo i am not entered the value then i manually check the validation.
    whether the combo have value or not. After validate the value is not there then want to focus the combo.
    is it possible.

    Combo Box Auto Focus #11353

    Dimitar
    Participant

    Hello RavikumarR,

    Could you, please, post a code sample so that we may be able to reproduce the reported behaviour and be able to help?

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Combo Box Auto Focus #11354

    RavikumarR
    Member

    This is my code

    function CreateCombo(ComboId, ComboData, ComboColumns, ComboDisplay, ComboValue,ComboAutoHeight) {
    var theme = ”;
    var cmbData = document.getElementById(ComboData).value;
    var url = cmbData.replace(/#/g, ‘”‘);
    var lscode = ComboValue;
    var lsname = ComboDisplay;
    var lsCols = ComboColumns.split(‘,’);
    var source =
    {
    datatype: “json”,
    datafields: [
    { name: lsCols[0] },
    { name: lsCols[1] }
    ],
    id: ‘id’,
    localdata: url,
    async: false
    };

    var dataAdapter = new $.jqx.dataAdapter(source);
    $(ComboId).jqxComboBox({ selectedIndex: -1, source: dataAdapter, displayMember: lsname, autoDropDownHeight: ComboAutoHeight, dropDownHeight: 130, valueMember: lscode, width: 200, height: 20, theme: theme });
    }
    $(document).ready(function() {
    CreateCombo(‘#jqxProduct’, ‘product’, ‘CompanyName,ContactName’, ‘ContactName’, ‘CompanyName’,true);
    CreateCombo(‘#jqxTeam’, ‘teamname’, ‘CompanyName,ContactName’, ‘ContactName’, ‘CompanyName’,true);
    CreateCombo(‘#jqxMessageType’, ‘messagetype’, ‘CompanyName,ContactName’, ‘ContactName’, ‘CompanyName’, true);
    CreateCombo(‘#jqxMessageIcon’, ‘messageicon’, ‘CompanyName,ContactName’, ‘ContactName’, ‘CompanyName’, true);
    CreateCombo(‘#jqxButtonStyle’, ‘buttonstyle’, ‘CompanyName,ContactName’, ‘ContactName’, ‘CompanyName’);
    CreateCombo(‘#jqxHelpId’, ‘helpid’, ‘CompanyName,ContactName’, ‘ContactName’, ‘CompanyName’);

    });

    var item_product = $(“#jqxProduct”).jqxComboBox(‘getSelectedItem’);
    if (item_product == null) {
    alert(“Please select value in Product”);
    // how to focus the JqxProduct combo
    return false;
    }

    In this JqxProduct Combo i want to focus …..

    Combo Box Auto Focus #11357

    Dimitar
    Participant

    Hi RavikumarR,

    To focus on a combobox’s text input, you may do the following:

                var item_product = $("#jqxProduct").jqxComboBox('getSelectedItem');
    if (item_product == null) {
    alert("Please select value in Product");
    $("#jqxProduct input").focus();
    };

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Combo Box Auto Focus #11358

    RavikumarR
    Member

    Hi Dimitar,
    Thanks for your response . its working fine.
    i have one more clarification in tab page movement. i have place the combos contiguously . tab movement is not proper.
    double tab then only it will focused.

    Combo Box Auto Focus #11360

    Dimitar
    Participant

    Hi RavikumarR,

    This is because the first time when the Tab key is pressed, the focus goes to the combobox arrow (you can then press Enter and the select options will be shown) and on the second press, the focus goes to the combobox input.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Combo Box Auto Focus #11361

    RavikumarR
    Member

    Hi Dimitar,
    Thanks for your information Dude…

    With Regards,
    Ravikumar.R

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.