Skip to Content
author's profile photo Former Member
Former Member

Set valeus to Inputfields when user press Enter

Hi,

I am new to BSP. Could you help me on below requirement.

I have 5 fields on the page. ex employee no, name, departmet, section etc.

If i fill employee no and press enter key rest of the fields shoud be filled automatically.

Best Regards

Rayudu

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2009 at 07:28 AM

    Hi,

    First make the attrubute "submit to ENTER" of employee number inptfield to true

    then in onINputprocesing event of page write this code

    event = cl_htmlb_manager=>get_event( runtime->server->request ).
    
    IF event IS  INITIAL.
    
    *here you write the select query code for selecting the name, department, section for the employee number entered
    
    *assigned the seelcted value to the variable used in value attribute of all this field
    
    endif.

    Hope it works

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 18, 2009 at 10:07 AM

    Hi Ray,

    You can use the below mentioned code to triger a server event on hit of ENTER hey..

    < s cript langu age="Java Script" t ype="te xt/ javascript"> 
    docum ent.onkey down=func tion()  
    {
    i f (eve nt.keyC ode= =13){
     
      return  htmlbSL(this,2,'Button_id:your_button_event')
     
          }
       }
        </s cript>

    In Layout..

    <htmlb:inputField id       = "emp_num"
                            value    = "<%= emp-num %>"
                            disabled = "false" />
    
    
    <htmlb:inputField id       = "designation"
                            value    = "<%= gv_designation_value %>"    />

    When the user enters EMP NUM and Enter is pressed , a server event is trigered and you can fill the variable gv_designation_value , which will be displayed in layout.

    Regards,

    Anubhav

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 18, 2009 at 11:30 PM

    Hi Rayudu,

    What you can do is,

    <htmlb:inputField id            = "emn"
                      tooltip                       = "Employee Number"
                      value                        = "//model/mv_employee_id" 
                      submitOnEnter          = "TRUE"
                      alignment                  = "RIGHT"
                      doValidate                 = "TRUE" />

    I have mentioned model you may use controller attribute as well:

    value                        = "<%=controller->mv_employee_id%>"

    In method Do_Handle_event of your controller class catch the event "emn" and now you can populate rest of the fileds such as name, departmet, section etc based on your employee ID.

    Hope this is helpful and so points would be appreciated.

    Regards,

    Abhinav

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 18, 2009 at 11:32 PM

    Also check this thread [Link|inputfield--enter]

    Regards,

    Abhianv

    Edited by: Abhinav Tayal on Mar 19, 2009 10:41 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2009 at 08:04 AM

    Dear Rayudu,

    You can achieve this requirement by using the SubmitOnEnter property of Inputfiled. And in the value property have to bind the controller variable. So that in the Do handle Data you can get the value of that Employee number field. Based on that you can get the remaining fields value from database or do your calculations and assign to the corresponding fields.

    In Layout

    <htmlb:inputField      id        = "emp_no"
                            type      = "string"
                        submitOnEnter = "True"
                            disabled  = "<%=controller->emp_no%>"
                            size      = "10"
                            value     = "<%=controller->emp_no%>"  />

    In Do_handle_data

    READ TABLE form_fields WITH KEY name = 'emp_no'
                                               INTO ls_form_field.
      
            do your requirement. Assign values to other fields value
       

    Appreciate if its Helpful.

    Regards,

    Anita Vizhi Arasi B

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2009 at 12:08 PM

    Hi

    We need to capture the input id, and get the id in eventhandler and by using methods we can get the values, and again to dispaly the data get the value in layout using table-view.

    Here is the sample code:

    Declare the following code in layout for input field:

    inputField id    = "emp"
                                  value = "<%= w_input%>"
                                  width = "100"
                                    size="6"

    Declare the following code in oninputprocessing

    call method cl_htmlb_manager=>get_event
      exporting
        request = runtime->server->request
      receiving
        event   = w_event.
    
    case w_event->id.
      when 'get'.
        call method cl_htmlb_manager=>get_data
          exporting
            request = runtime->server->request
            name    = 'inputfield'
            id      = 'emp'
          receiving
            data    = w_obj.
        w_emp ?= w_obj.
        w_empid = w_emp->value.
    
        w_input = w_empid.

    Hope this helps you.

    Regards,

    Rajani

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.