Skip to Content
author's profile photo
Former Member

how to use get values from input field

here is my code

im trying to get values from iput field and store it ina table

when i click save all these values need to be saved in my ztable.

*If 'save' is clicked

IF BUTTONGROUP->BUTTONCLICKED = 'save'

AND EVENT->EVENT_TYPE = 'clicked'.

IF NOT FLAG = 'view'.

CALL_VIEW( VIEW ).

else.

model1->partner = REQUEST->GET_FORM_FIELD( NAME = 'partner' ).

data datvar type string.

model1->partner = REQUEST->GET_FORM_FIELD( NAME = 'partner' ).

datvar = REQUEST->GET_FORM_FIELD( NAME = 'termina' ).

model1->terminated = datvar.

datvar = REQUEST->GET_FORM_FIELD( NAME = 'srty' ).

model1->srtype = datvar.

datvar = REQUEST->GET_FORM_FIELD( NAME = 'yoh' ).

model1->yohlob = datvar.

model1->SET_DATA( REQUEST = REQUEST ).

model1->SAVESTATUS = 'UNSAVED'.

model1->SAVE_TO_ZCOM( ).

  • If model1->savestatus = 'DONE'.

  • ENDIF.

endif.

please help

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Sep 29, 2005 at 07:30 PM

    Are you using MVC? Where is your code sitting, do_request, do_handle_event?

    Consider model binding. On your htmlb input fields, use value="//model/partner".

    Sorry if that's a little vague, tell me some more about your application.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Ashadeep,

      You have to just use set cookie method for that.

      In new.do's Data handle event set the cookie for the input field.

      call method runtime->server->response->set_cookie

      exporting name = 'inputfield'

      path = '/'

      value = inputfield.

      And in new1.do's do request you have to retrieve values by

      call method runtime->server->request->get_cookie

      exporting name = 'inputfield'

      importing value = inputfield.

      CALL METHOD page->SET_ATTRIBUTE

      EXPORTING

      NAME = 'inputfield'

      VALUE = inputfield.

      Hope this helps.

      Amit

  • author's profile photo
    Former Member
    Sep 30, 2005 at 04:56 AM

    hi,

    Instead of writting handle event in do_request

    write it inside do_handle_event method of your controller class.

    to capture valuse of input fields you do not require to define a page attribute just use following method of request class.this gets the values of all form fields in a table(fields of type TIHTTPNVP) of name value pair.

    CALL METHOD request->if_http_entity~get_form_fields

    CHANGING

    fields = fields.

    use fiollowing code in your do_handle_event

    -


    data:

    fields type TIHTTPNVP,

    wa_fields like line of fields.

    case event.

    when 'save'. "save is your button id

    CALL METHOD request->if_http_entity~get_form_fields

    CHANGING

    fields = fields.

    loop at fields into wa_fields .

    IF WA_FIELDS-name = 'partner'."this will check for form field

    model1->partner = wa_fields-value."you will get value of input field partner in model1->partner.

    endif.

    IF WA_FIELDS-name = 'termina'.

    model1->terminated = wa_fields-value.

    endif.

    "so on..

    endloop.

    -


    this way you can get the values of all your form fields including input fields.

    do not forget to write dispatch_input(). inside do_request method prior to calling of view. then only events are listened.

    hope this you. else reply,

    Regards

    Hemendra

    Add comment
    10|10000 characters needed characters exceeded