cancel
Showing results for 
Search instead for 
Did you mean: 

Urgen:How to read inputfields from the HTML layout into On Input Processing

Former Member
0 Kudos

Hi All

I have created a BSP page 'create.htm' . I have designed a HTML layout where i have created inout text field so that suer can input his answers . Now i want to read this input text field (as to what are its contents that has been input by the user) in my On Input Processing Method . Can some one give any idea as to how i can read these input fields on my HTML layout ? Is there any class or method provided by SAP to achieve so ?

Any help here is highly appreciated .

<b></b>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi manoj,

If ur using HTMLB then

<htmlb:inputfield id = "myid" value = "asd" > ,

u should do it as follows :

In oninputprocessing:

data : txt1 type ref to cl_htmlb_inputfield.

now read the inputfield into object txt1.

txt1 ?= CL_HTMLB_MANAGER=>GET_DATA(

request = runtime->server->request

name = 'myid'

id = 'myid'

).

where 'myid' is the id u have supplied to inputfield .

and the value odf inputfield is " txt1->value " .

hope it will help u.

Regards,

Ankur

Answers (4)

Answers (4)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

There is another option here that hasn't been discussed yet. If you use Model-View-Controller, you can bind your Model Attribute to the Input field

<b>Code for Input Field Definition:</b>


<htmlb:inputField value="//model/matnr" />

<b>Code for Reading the value of the Input Field:</b>

...

That's right - there is no code. The MVC runtime does this for you. Because your field is bound, it automatically copies the value in the frontend input field control back into your model attribute on Input Processing.

Private_Member_9643
Active Contributor
0 Kudos

hi manoj,

try this code:

<b>data: name type string.

name = request->get_form_field( 'inputFieldName' ).</b>its a much better code, easy to understand i think, Try it.

Regards,

kamaljeet

Former Member
0 Kudos

CALL METHOD request->get_form_fields

  • EXPORTING

  • FORMFIELD_ENCODING = 0

CHANGING

fields = lt_fields

.

in the OnInputProcessing Event handler

or single fields

REQUEST->GET_FORM_FIELD( FIELDNAME ).

Regards,

Christoph

Message was edited by: Christoph Aschauer

Former Member
0 Kudos

Hi Christoph,

Thanx a lot for your response .

As you have said that :-

CALL METHOD request->get_form_fields

  • EXPORTING

  • FORMFIELD_ENCODING = 0

CHANGING

fields = lt_fields

I assume "Request" as a class and "get_form_fields" is a method but I when I am seeing in SE24 I am not able to see this Class. So Let me know if "Request" is a global Class or not and where can I see its definition.

Former Member
0 Kudos

Hi,

"request" can be used directly like "application" (for the Session Class).

get_form_fields is a interface method of IF_HTTP_ENTITY,

implementation Class is CL_HTTP_ENTITY.

just dubble click the method an you will be routed to the interface method. See the signature there to get the table type of the fields (TIHTTPNVP).

Data: lt_fields type TIHTTPNVP.

CALL METHOD request->get_form_fields

  • EXPORTING

  • FORMFIELD_ENCODING = 0

CHANGING

fields = lt_fields

.

Christoph

Former Member
0 Kudos

hi manoj,

request , response, navigation are global objects.

u can find more documentation at :

http://help.sap.com/saphelp_nw04/helpdata/en/01/ad1e3a0088e042e10000000a11402f/frameset.htm

Hope it will help u.

Regards,

Ankur

Former Member
0 Kudos

Please open the SBSPEXT_HTMLB BSP application in trasnaction SE80 and look at the inputfield example.

All the code you need is there.