Skip to Content

Inputfield in a tableview: .... where are my entered values??!!

I am on the way to write a BSP for an online store. I created a table with some articles (materialno., text, quantity and an "add to basket"-button).

The quantity is defined as an inputfield. In the OnInputProcessing event I try to get the value of the input and as well the number of the selected material. But the fields are always empty...

Here the code:

LAYOUT:

<%@page language="ABAP" %>

<%@extension name="htmlb" prefix="htmlb" %>

<htmlb:form>

<htmlb:tableView id = "tvX"

headerText = "Materials"

headerVisible = "true"

design = "alternating"

visibleRowCount = "10"

fillUpEmptyRows = "true"

onHeaderClick = "MyEventHeaderClick"

onRowSelection = "MyEventRowSelection"

selectionMode = "LINEEDIT"

keyColumn = "matnr"

table = "<%= t_mat2 %>" >

.

.

.

.

<htmlb:tableViewColumn columnName = "smeng"

wrapping = "false"

horizontalAlignment = "right"

type = "user"

title = "quantity" >

<htmlb:inputField id = "smeng"

width = "100%"

cellValue = "true"

type = "string" />

-


ON INPUT PROCESSING:

tv ?= CL_HTMLB_MANAGER=>GET_DATA(

request = request

name = 'tableView'

id = 'tvX' ).

IF tv IS NOT INITIAL.

tv_data = tv->data.

IF tv_data->SelectedRowIndex IS NOT INITIAL.

DATA value1 TYPE string.

DATA name1 type string.

name1 = tv_data->GET_COLUMN_NAME(

column_index = '3' ).

value1 = tv_data->GET_CELL_ID(

row_index = tv_data->SelectedRowIndex

column_index = '3' ).

inputfield ?= CL_HTMLB_MANAGER=>GET_DATA(

request = request

name = 'inputField'

id = value1 ).

data valuex type string.

if inputfield->value is not initial.

valuex = inputfield->value.

endif.

==> inputfield->value is ALWAYS empty.

Thanks for help!!

Beat Kohler

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jul 07, 2004 at 11:28 AM

    Hallo Beat,

    Just a small remark, I am not sure if only your example is just a cut&paste mistake, but you are missing <htmlb:content> and <htmlb:page> tags.

    The problem is unfortunately slightly more complex. What you write is:

    <htmlb:tableViewColumn columnName = "smeng" ...> 
      <htmlb:inputField  id   = "smeng"
                         type = "string" />
    </htmlb:tableViewColumn>

    What happens here is that when the tags are processed, first the tvColumn tag is started. It is then pushed onto the stack, and then the inputField is completely processed. This tag just have static parameters and writes out its complete output. This is a <b>static string</b> that is now given as input into each cell in this column. So effectively you have N of these inputfields, all with the same name and id of "smeng". Which not the name for which you are trying to retrieve the data again.

    The way that we handled this in design2002 is using a concept called $$ replacement. You can look in SBSPEXT_HTMLB\tableView.bsp for a commented out example of this. Unfortunately, it is <b>NOT</b> possible for us to support this in design2003. Also this $$ concept has caused many problems (special handling all over). It was an idea which we should not have shipped :(.

    Our current recommendation is to write an iterator, and feed the tableView in this way. The same example page has an example of this. Also read the following two articles for some background.

    <b>BSP Programming: BSP Element Expressions (BEEs)</b>

    /people/brian.mckellar/blog/2003/10/30/bsp-programming-bsp-element-expressions-bees

    <b>BSP Programming: HTMLB TableView Iterator</b>

    /people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator

    ++bcm

    Add comment
    10|10000 characters needed characters exceeded