Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Relation between dropdownlistbox and input field

hi, i'm newbie in bsp.

My problem is:

I have one page, one form and one dropdownlistbox and one inputfield. I want to change value in inputfield in relation to selected value in dropdownlistbox dynamically.

Please help me

pacho

Former Member
replied

changing the input field value on the client is not possible with ABAP code , you need to use javascript.

check out this sample code

<b><u>page attribute</u></b>

tab1 TYPE TIHTTPNVP

tab1_wa TYPE IHTTPNVP

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title=" " >
    <htmlb:form>
      <%
  clear tab1_wa .
  refresh tab1 .
  move: 'PRI' to tab1_wa-name ,
  'Printer' to tab1_wa-value .
  append tab1_wa to tab1 .
  move: 'FAX' to tab1_wa-name ,
  'Fax' to tab1_wa-value .
  append tab1_wa to tab1 .
  move: 'EMA' to tab1_wa-name ,
  'Email' to tab1_wa-value .
  append tab1_wa to tab1 .
      %>
      <htmlb:label for  = "DDLB1"
                   text = "Carrier" />
      <htmlb:dropdownListBox id                = "DDLB1"
                             nameOfKeyColumn   = "NAME"
                             nameOfValueColumn = "VALUE"
                             table             = "<%= tab1 %>"
                             onClientSelect    = "javascript:dd = document.forms[0].DDLB1;document.forms[0].IP1.value = dd.options[dd.selectedIndex].value ;alert(dd.options[dd.selectedIndex].value);"
                             width             = "150" />
      <htmlb:inputField id   = "IP1"
                        type = "STRING"
                        size = "50" />
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

try it out and let us know.

Regards

Raja

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question