Skip to Content
author's profile photo Former Member
Former Member

triggering DropDownList onclick event via scripting

Hi, I have a form with some inputfields and a dropdownlistbox named <b>editField</b>. When the user focus an inputfield the dropdownlistbox must change showing the name of the field selected.

So, I have use the following technique to capture the OnFocus event:


function selectFieldForEdit(field) {





data rep_string type string.

rep_string = `<input onFocus="javascript:selectFieldForEdit(this);"`.


<bsp:findAndReplace find = "<input" replace = "<%= rep_string %>" >

<htmlb:inputField id="Scons" value="<%= Scons %>" />


With the script function <b>selectFieldForEdit(field)</b> I am changing the value of the selected item in the combo box but I then whant to trigger the "selected" event.

Can anyone give me an idea of how to continue this script?



Message was edited by: Ariel Ferreiro

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jan 13, 2005 at 07:47 AM

    Hello Ariel,

    that quite tricks. i have implemented something quite similiar:

    Two Listboxes: when the user selects a value from the first, the values of the second one changes.

    Look at the following code (runable):



    <script language="JavaScript" TYPE="text/javascript">

    var store = new Array();

    store['010'] = new Array(


    'TI (Technical Information)','010',

    'TD (Technical Datasheet E-direct)','014',

    'AI (Application Information)','020',

    'BA/KA (Operating Instruction)','030',

    'UA (Conversion Intruction)','050',

    'EA (Mounting Instruction)','060',

    'XA (Ex Safety Instructions)','070',

    'ZE (Certificate)','080',

    'ZD (Certificate FM/CSA)','090',

    'SF (Service Info)','100',

    'SH (Service Manual)','110',

    'SD (Special Documentation)','120',

    'GI (Basic Information)','130',

    'PL (Price List)','140',

    'SU (Seminar Documentation)','150',

    'MA (Measurement+Automation)','160',

    'PG (Product Group)','170',

    'PK (Practical know-how)','180',

    'SI (System Information)','190',

    'SP (Special Promotion)','200',

    'CM (Customer Magazine)','210',

    'SM (Staff Magazine)','220',

    'PU (Publications)','230',

    'NL (Newsletters)','240',

    'PA (Process Automation)','250',

    'FI (Field Instrumentation)','260',

    'SO (Industry Solutions)','270',

    'FA (Fields of Activities)','280',

    'CP (Competence Brochure)','290',

    'CS (Case Studies)','300',

    'IN (Innovations)','310',

    'SP (System Partner)','330',

    'EC (Endress+Hauser Catalogues)','340',

    'MA (Measurement+Automation)','350',

    'PG (Product Group)','360',

    'PK (Practical know-how)','370',

    'SI (System Information)','380',

    'SP (Special Promotion)','390',

    'CH (Changes)','400'


    store['020'] = new Array(


    'Configuration Software','010',

    'Device Drivers','020',



    'User Tools','050'


    store['030'] = new Array(





    'Graphic (Vector) / CAD','050'


    function showVersion(content_type,type)


    switch (content_type)


    case ' ':


    case '010':

    document.getElementById("type").style.display = "block";

    document.getElementById("types").style.display = "block";



    case '020':

    document.getElementById("type").style.display = "block";

    document.getElementById("types").style.display = "block";



    case '030':

    document.getElementById("type").style.display = "block";

    document.getElementById("types").style.display = "block";




    document.getElementById("type").style.display = "none";

    document.getElementById("types").style.display = "none";



    function populate(type)


    var box = document.forms['search'].content_type;

    var number = box.options[box.selectedIndex].value;

    if (!number) return;

    var list = store[number];

    var box2 = document.forms['search'].type;

    box2.options.length = 0;



    box2.options[i/2] = new Option(list<i>,list[i+1]);

    if(box2.options[i/2].value == type){

    box2.options[i/2].selected = true;







    <body method="post">

    search.htm" method="post" name="search">

    <select name="content_type" class="single_select" onchange="showVersion(this.value,'')">

    <option value=" " style="font-style:italic"></option>

    <option value="010" >Documentation</option>

    <option value="020" >Software</option>

    <option value="030" >Multimedia</option>


    <div id="types" style="display:none">

    <select name="type" id="type" class="single_select">

    <option value=""></option>






    Best regards,


    Add a comment
    10|10000 characters needed characters exceeded

    • Ariel,

      I am going to seriously recommend that you do NOT look to deep at the HTML we render. These sapUrMapi stuff has a habit of chaning per service pack at the moment, and this it definitely not something we will support. We don't even want to know what you are doing.

      That said, from reading the rest of this thread, I would like to recommend one document to you: <a href="/people/brian.mckellar/blog/2004/07/18/bsp-in-depth-using-the-htmlb-event-system">BSP In-Depth: Using the HTMLB Event System</a>. It contains a lot of background information that will definitely help you.


  • Posted on Jan 13, 2005 at 07:38 AM

    Upon focus on input field you are changing the selected value in the dropdownlistbox, this should have triggered the onSelect or onClientSelect of dropdownlistbox if you have maintained the onSelect or onClientSelect properties of <htmlb:dropdownListBox.

    Have you maintained those properties for <htmlb:dropdownListBox and still the event is not triggered?



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.