cancel
Showing results for 
Search instead for 
Did you mean: 

Drop Down Lilst Box

raja_thangamani
Active Contributor
0 Kudos

Hi,

I am using HTMLB DropdownList Box element.

Could anybody tell me how to make it as <b>editable</b> DropdownList Box? i.e., Value can be selected from dropdown list as well as it can be freely keyable.

I Promise to return and reward the answer.

Waiting for your valuable reply.

Thanks in advance.

Raja T.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Raja,

Normally this element is named "combobox".

Check the <<b>p</b>htmlb:combobox> tag.

Unfortunatelly this is the very new tag and there is no standatrd exmples of using it.

Artem.

thomasalexander_ritter
Active Contributor
0 Kudos

Hi Raja,

Artem is right. The combobox tag does exactly what you want. Since I was exited about this little new toy I wrote a simple example application. Take a look at the following code:

In your view:


  <%
  data tab_spfli type table of spfli.
  select * from spfli into table tab_spfli.
  %>
  <phtmlb:comboBox id                = "combobox_test"
                   behavior          = "FREETEXT"
                   nameOfKeyColumn   = "CITYFROM"
                   nameOfValueColumn = "CITYFROM"
                   table             = "<%= tab_spfli %>" />

To get the selected <b>OR</b> entered value:


  field-symbols: <field> type ihttpnvp.

  read table form_fields with table key
             name = 'combobox_testvalue' assigning <field>.
  "yourvariable" = <field>-value. 

and thanks to Artem I learned something new today 😃

regards

Thomas

athavanraja
Active Contributor
0 Kudos

Hi Artem and Thomas. Thanks for the info and the sample guys.

I was looking for a dropdown box with <optgroup> options.

(i am now using palin html in BSP page to achieve this) Will phtmlb:comboBox can do that? i see two value columns(nameofValueColumn and nameofValue2Column) attribute may be thats for grouping?

Regards

Raja

(this is different Raja, not the originator of this thread)

thomasalexander_ritter
Active Contributor
0 Kudos

Hi,

I explored the extension a little bit further and it seems that the second column is really just a second column and can't be used for grouping.

So my results are:

NEWYORK US

SANFRANCISCO US

and not

US

NEWYORK

SANFRANCISCO

regards

Thomas

athavanraja
Active Contributor
0 Kudos

Thanks for taking time to try it out.

Thank you very much Thomas.

Regards

Raja

raja_thangamani
Active Contributor
0 Kudos

Hi Thomas Ritter,

Thanks for your valueable information. I try this option and get back to you with value points.

With Regards,

Raja T (Originator of this Thread ) )

raja_thangamani
Active Contributor
0 Kudos

Dear Thomas,

I have tried Combobox option. But i could not able to enter the text(Free) as well as what ever the value i have entered, its not getting selected in the dropdownlist. I am attaching the code below. Could you tell what is there any parameter needs to be added.


<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<%@extension name="phtmlb" prefix="phtmlb" %>
<htmlb:content id     = "content"
               design = "DESIGN2003" >
  <htmlb:document>
    <htmlb:documentHead>
    </htmlb:documentHead>
    <htmlb:documentBody>
      <htmlb:form method = "post" >
        <%
  data tab_spfli type table of spfli.
  select * from spfli into table tab_spfli up to 20 rows.
        %>
        <phtmlb:comboBox id                = "combobox_test"
                         behavior          = "FREETEXT"
                         enabled           = "X"
                         nameOfKeyColumn   = "CITYFROM"
                         nameOfValueColumn = "CITYFROM"
                         table             = "<%= tab_spfli %>" />
      </htmlb:form>
    </htmlb:documentBody>
  </htmlb:document>
</htmlb:content>

Thanks

Raja T .

thomasalexander_ritter
Active Contributor
0 Kudos

Hi Raja,

I was a little bit surprised at first but now it is logical why your combobox didn't work. You have to fill the <b>onSelect</b> attribute. If you don't fill it no event will be triggered when the user selects an listentry or types in his own entry and presses the <b>enter key</b>.

This morning I tested this code and it worked perfectly:

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="phtmlb" prefix="phtmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<htmlb:content id     = "content"
               design = "DESIGN2003" >
  <htmlb:document>
    <htmlb:documentHead>
    </htmlb:documentHead>
    <htmlb:documentBody>
     <htmlb:form>
     <%
     data tab_spfli type table of spfli.
     select * from spfli into table tab_spfli.
     %>
     <phtmlb:comboBox id                 = "combobox_test"
                   behavior           = "FREETEXT"
                   nameOfKeyColumn    = "CITYFROM"
                   nameOfValueColumn  = "CITYFROM"
                   nameOfValue2Column = "COUNTRYTO"
                   onSelect           = "trigger"
                   table              = "<%= tab_spfli %>" />
    </htmlb:form>
  </htmlb:documentBody>
  </htmlb:document>
</htmlb:content>

regards

Thomas

raja_thangamani
Active Contributor
0 Kudos

Hi Thomas Ritter,

Thanks Lot for your valueable input. Our lot of problems got solved due to this. Also i gave you the reward points.

Thanks,

Raja T

raja_thangamani
Active Contributor
0 Kudos

Hi Thomas Ritter,

Now i am facing another problem that i could not capture the event which is triggered by Combobox.

I am calling it thro MVC architecture. DO_HANDLE_EVENT method is not getting triggered. Also i was trying to capture the event as follows:

  DATA: COM_EVENT TYPE REF TO IF_HTMLB_DATA.
  COM_EVENT = CL_HTMLB_MANAGER=>GET_EVENT_ex( REQUEST ).

Here COM_EVENT->EVENT_NAME is blank.

Could you tell me how to capture the event.

Raja T.

Answers (1)

Answers (1)

thomasalexander_ritter
Active Contributor
0 Kudos

Hi Raja,

The standard htmlb dropdownlist element will not allow you to do this. So you have to build your own. Take a look at the following link which has all the html+javascript code you need.

<a href="http://webdeveloper.earthweb.com/repository/javascripts/2004/10/609371/pp_editable_dropdown.html">check it out</a>

Have fun

regards

Thomas