Focus Input Field

Hi,
I am designing a dynpropage with 7 input fileds and a few buttons. Thing is when I nevigate to this view, my First Input Field should be FOCUSED.
At present when I navigate nothing is focused.
Pl help.
Thanks,
Hardik

In order to get focus you need to call focus method for that particulat UI element. In  WDDOMODIFYVIEW method of the VIEW
data: lr_inp_field type ref to cl_wd_input_field.
//create instance
or get the reference to your existing Inputfield from the view in the WDDOMODIFYVIEW method as
lr_inp_field  = view->get_element( 'INP_NAME' ). "where INP_NAME is the inputfield UI element ID.
//call method
lr_inp_field->focus( ).
or
view->request_focus_on_view_elem(  lr_inp_field  ).
greetings
Prashant

Similar Messages

  • How to set focus on a input field in a selected row of a table?

    In a previous discussion (http://scn.sap.com/thread/3564789) I asked how to access an input (sap.m.Input) field of a selected row in a table. In the answer that was supplied I was shown how to get the items of the table. Then using the selected index to get the selected item get the cells. Then I could set editable on the proper cell(s). This worked fine.
    Now I need to set the focus on one of the fields. I tried something like this:
                var oNewLink = table.getSelectedItem();
                var oNewLinkName = oNewLink.getCells()[1];
                oNewLinkName.focus();
    But this doesn't seem to work.
    I have searched through other discussions and have seen this technique for putting focus on a field if you have its ID:
    sap.ui.getCore().byId(id_of_the_input_field).$().focus();
    In my case though I do not have an ID since the row and its cells are generated. How can I set focus on the cell of a certain row in a table?

    Hello Venkatesh. Yes that code does work. First I tried it on a table cell that was already rendered and it did work. The next time I tried it on a table row that was being added and it did not work there. So I added an on after rendering function for the table and added that code there. That did not work until I added a delay (timeout) to do a context switch before calling the focus and that worked.
    Once last thing though sometimes when I call focus on an input field (actually in a table row cell) if the field has text in it already the flashing cursor is at the beginning of the text and other times it is at the end of the text (which is the desired way). It depends on where I click in the row. Is there anyway to make sure the flashing cursor is at the end of the text when the focus is applied to a field that contains text?

  • How to set focus on invisible input field?

    Hi Guys,
    I need an invisible input field and have to set an input focus on it. My problem is that if I set input field’s property visible=blank, I get my invisible field <b>BUT</b> the function call doesn’t work (setInput.requestFocus()).
    I suppose that I can’t set a focus if an input field is invisible.
    Does somebody know how can I solve my problem? Is there a possibility to do this input field invisible with java script? If yes, how does it work in Web Dynpro?
    Thanks
    Marita

    Hi
      Setting a focus on invisible input field will not work even if you follow the method what sowjanya has suggested. The method wdThis.wdGetAPI().requestFocus() will not work for read-only and disabled fields.
    By the way why do you want to set the focus on a invisible input field. If you can tell us the requirement maybe we could think of an alternate solution. But i guess for the current scenario setting focus on invisible input field does not work.
    regards
    ravi

  • How to set focus on an input field by coding?

    Dear friends,
    Do you have such experience if we can set focus on an input field by code?
    Thanks and best regards,
    Anders

    Hi,
    There are two ways to set the focus of an inputfield.
    1) In the BSP page add the attribute focus to an inputfield and set it to true.
    Ex: <thtmlb:inputField id = "test"
                          focus = "TRUE"/>
    2) Using the P-getter in the case where the inputfield is created using the config tool.
    Ex: CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter=>fp_focus.
    rv_value = abap_true.
    ENDCASE.
    regards,
    MuralidharPrasad.C

  • Transferring focus to the next input field

    I have a group of input fields which are supposed to accept a single digit as input. By using a custom document, I am able to restrict the input. Once a valid input character has been entered, I would like to automatically transfer focus to the next JTextField from within my Document's insertString() method. Is there any way I could do something like that?

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    public class ValidTransit
        private JPanel getContent()
            FocusListener fl = new EntryListener();
            DocumentListener tl = new TransitChecker();
            DocumentFilter vf = new ValidFilter();
            JPanel panel = new JPanel();
            panel.add(getTextField(fl, tl, vf));
            panel.add(getTextField(fl, tl, vf));
            panel.add(getTextField(fl, tl, vf));
            return panel;
        private JTextField getTextField(FocusListener fl, DocumentListener dl,
                                        DocumentFilter vf)
            JTextField tf = new JTextField(2);
            tf.addFocusListener(fl);
            AbstractDocument doc = (AbstractDocument)tf.getDocument();
            doc.addDocumentListener(dl);
            doc.setDocumentFilter(vf);
            return tf;
        public static void main(String[] args)
            ValidTransit test = new ValidTransit();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(test.getContent());
            f.setSize(300,140);
            f.setLocation(200,200);
            f.setVisible(true);
    class EntryListener extends FocusAdapter
        public void focusGained(FocusEvent e)
            JTextField tf = (JTextField)e.getSource();
            tf.selectAll();
    class TransitChecker implements DocumentListener
        public void insertUpdate(DocumentEvent e) { checkLength(e); }
        public void removeUpdate(DocumentEvent e) { checkLength(e); }
        public void changedUpdate(DocumentEvent e) { /* styled text */ }
        private void checkLength(DocumentEvent e)
            if(e.getDocument().getLength() == 1)
                KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent();
    class ValidFilter extends DocumentFilter
        String domain = "0123456789";
        public void insertString(DocumentFilter.FilterBypass fb,
                                 int offset,
                                 String str,
                                 AttributeSet attrs) throws BadLocationException
            replace(fb, offset, 0, str, attrs);
        public void replace(DocumentFilter.FilterBypass fb,
                            int offset,
                            int length,               // selected text
                            String str,               // incoming string
                            AttributeSet attrs) throws BadLocationException
            char[] source = str.toCharArray();
            char[] result = new char[source.length];
            int k = 0;
            for(int j = 0; j < source.length; j++)
                if(domain.indexOf(source[j]) != -1)
                    result[k++] = source[j];
                else
                    Toolkit.getDefaultToolkit().beep();
            fb.replace(offset, length, new String(result, 0, k), attrs);
    }

  • Input Field in table - I need a OnClick Event

    Hello everybody,
    I have the following problem:
    I have created a table in my view which is filled at runtime. The table has 3 different rows and every row has TableSingleMarkableCells, these cells further have a input field as their celleditor.
    I now want to know which cell the user is editing. I have a AttributePointer through which I know that at the time the user presses the enter key. But I need to know whether the focus has changed. Because there is the possibility that the user switches between the differnt cells with the arrow key or the tab key. But the AttributePointer only gives me the first selected cell.
    Have anybody a suggestion to solve this problem -  it seemed to be something like definingb a OnClick event for a input field (additionaly to the default OnEnter event...)
    Best regards,
    Sebastian

    Hi,
    You can find out at which row the editing goes, by using
    onLeadSelect action of TableUIElement.
    in onLeadSelect action you can find row number using this statement
    int rownumber= wdContext.node<TableNode>().getLeadSelection();
    Regards
    LakshmiNarayana

  • LOV for an unbound input field in ADF-JSP

    Hi i have a web app using ADF BC, struts , JSP.
    Jdev - 10.1.2
    JHS - 10.1.2
    I have a text field <input type="text" value="solution">
    I need to populate this UNBOUND input field with a value from an LOV which pops up in a separate window.
    I need help right from the beginning... which i guess wud be to create a VO for it.. i have never done it earlier so any help wud be useful.

    Hi,
    try
    <BODY onload="document.DataForm.EmployeeId.focus()">
    where EmployeeId needs to be substituted by the name used in the textfield property
    <html:text property="EmployeeId"/>
    If this was Empno then the example would be
    <html:text property="Empno"/>
    and
    <BODY onload="document.DataForm.Empno.focus()">
    Frank

  • HTMLB .. Input field event handling..

    Hi guys,
    I have a input field htmlb in my jsp. I have to handle on blur event for this.. i.e if a user gives in somethin in the input field and once it looses focus, a event should get triggered. And probably in my case it will be helpful for me if I have this event handler method in the dynpage. For this kind of event handling what should I write in the followin tag
    <htmlb:inputfield id="" value="" width=""> plz tell me a tag attribute which supports this event.
    Regards,
    PP.

    Hi Priyanka,
                      You can get reference of your input field in JSP into DynPage. Do like this:
    Declare input field in JSP
    <hbj:inputfield id="input"  value="test">
    In DynPage, get refernce of the input field
    Wherever you want to trigger event
    InputField myInputField =(InputField) getComponentByName("input");
    myInputField.setClientEvent();
    Hope this helps.
    regards,
    Siva
    Note: If you get success, please post the solution before you close this thread.
    Message was edited by:
            Siva Rama Krushna

  • Create dynamically a number of Input Fields

    hi all,
    one issue about creating dynamically a range of Input fields:
    i have one sap.ui.layout.form.FormContainer.
    at first i want to have one Input field in it. if this field is filled, i want to have a new one below, which is empty, and the cursor should be set to the new field.
    so i know that there is an function addContent for the formcontainer, so i can listen to the changeEvent of the Input field, if this is filled i will add a new Input field.
    at first: is this a good solution or is there any recommended way from SAP?
    second: if i will implement it this way, how can i read the data from this "array" of input fields?
    third: how can i set focus on input field in sapui5?
    thanks for help!
    Regards,
    Alex

    1) Solution sounds good to me
    2) You can do it in multiple ways:
    you can use content aggregation from FormContainer
    you can access Input field by id (you would need to follow some kind of convention when giving id to newely created field, like "inputField" + count, count ++)
    you can use RowRepeater (not sure though how it looks in FormContainer) and use a model for bining
    3) SAPUI5 SDK - Demo Kit From my experience element.focus() works just fine

  • REPORT_ATTRIBUTE_ERROR_MESSAGE functionality for Input Field & Drop down UI

    Hi,
    We have requirement to handle error messages. In a data input form, if we get multiple errors we are displaying all errors in a message area. When we click on error message, focus should go to the UI element which causes to the error.
    We have used 'CALL METHOD lo_message_manager->report_attribute_error_message' by exporting the element and attribute name. This method works fine incase of Input Field type UI element. When we run the application on DISPLAY action errors are displaying for both fields 'INPUT FIELD' and 'DROPDOWNBYINDEX' . But we have URL on the error related to 'INPUT FIELD'  and when we click on error message control/cursor going to the INPUT FIELD.
    But we could not find same functionality incase of DropDownbyIndex UI Element.
    Please help us to resolve the problem. Does SAP Web Dynpro ABAP provide this functionality?
    Below attached written code for reference.
    CASE lo_action->name.
          WHEN 'DISPLAY'.
            IF lv_num1 IS INITIAL.
             report message
              CALL METHOD lo_message_manager-report_attribute_error_message
                EXPORTING
                  message_text              = 'Please enter the value'
                  element                   = lo_el_numbers
                  attribute_name            = `NUM1`
                params                    =
                msg_user_data             =
                is_permanent              = ABAP_FALSE
                scope_permanent_msg       = CO_MSG_SCOPE_CTXT_ELEMENT
                msg_index                 =
                cancel_navigation         =
                is_validation_independent = ABAP_FALSE
            ENDIF.
            IF lv_age eq '999'.
             report message
              CALL METHOD lo_message_manager-report_attribute_error_message
                EXPORTING
                  message_text              = 'Please enter the age'
                  element                   = lo_el_personal_info
                  attribute_name            = `AGE`
                params                    =
                msg_user_data             =
                is_permanent              = ABAP_FALSE
                scope_permanent_msg       = CO_MSG_SCOPE_CTXT_ELEMENT
                msg_index                 =
                cancel_navigation         =
                is_validation_independent = ABAP_FALSE
            ENDIF.
        ENDCASE.
    Thanks
    Venkat

    Hi venki,
    The problem you have told that when you are displaying the error message for input box and drop down by idx  using the report_attribute_error_message. Then you click on the error message raised by input box , the focus goes to the input box but the same thing will not happen with the dropdownbyidx.
    I have also try the same this its not working for dropdownbyidx but it is working for dropdownbykey.
    You can try this.
    Regard
    Manoj Kumar

  • How to mask and format an input field at the same time?

    Dear Experts,
    I need to have an input field, which has the following behavior:
    1. The input field accepts only number, i.e. characters other than number are ignored (not displayed on the text field).
    2. The number is automatically formatted to ###,###,### as the user enter the number.
    Example as the user enter 1-2-3-4-5-6-7, the sequence of number displayed in the text field is:
    1
    12
    123
    1,234
    12,345
    123,456
    1,234,567
    I have done the following:
    import java.awt.*;
    import javax.swing.*;
    import java.text.*;
    import javax.swing.text.*;
    class FormattedTFDemo {
         NumberFormat cf;
         JLabel jlab;
         JFormattedTextField jftfSalary;
         JFormattedTextField jftfEmpID;
         JButton jbtnShow;
         public FormattedTFDemo() {
              JFrame jfrm = new JFrame("JFormattedTextField");
              jfrm.getContentPane().setLayout(new FlowLayout());
              jfrm.setSize(240, 270);
              jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              try {
                   MaskFormatter mf = new MaskFormatter("###,###,###");
                   jftfEmpID = new JFormattedTextField(mf);
              } catch (ParseException exc){
                   System.out.println("Invalid Format");
                   return;
              jftfEmpID.setColumns(15);
              cf = new DecimalFormat("###,###,###");
              jftfSalary = new JFormattedTextField(cf);
              jftfSalary.setColumns(15);
              jftfSalary.setValue(new Integer(7000));
              jfrm.getContentPane().add(new JLabel("First field"));
              jfrm.getContentPane().add(jftfEmpID);
              jfrm.getContentPane().add(new JLabel("Second field"));
              jfrm.getContentPane().add(jftfSalary);
              jfrm.setVisible(true);
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        new FormattedTFDemo();
    }The "First field" adopts no. 1 behavior, i.e. it does not allow any character other than numbers, but the "," are always displayed and the number displayed as I enter 1-2-3-4-5-6-7 are:
    1 , ,
    12 , ,
    123, ,
    123,4 ,
    123,45 ,
    123,456,
    123,456,7
    which is not according to behavior no. 2
    The "Second field" displayed 1,234,567 only after the focus left the text field and not while typing. Moreover, characters other than number can still be displayed and only rejected after the focus left the text field.
    I need a guide of what text field and what filter / format / mask I should use. Am I correct to use JFormattedTextField? Is the only way to accomplish this by using JTextField and create my own PlainDocument for the textfield, where
    I rebuild the displayed output after each character is entered?
    Thanks for any advice,
    Patrick

    So exactly what do you want the user to put in? and what do you want to see?
    I need to have an input field, which has the following behavior:
    1. The input field accepts only number, i.e. characters other than number are ignored (not displayed on the text field).
    2. The number is automatically formatted to ###,###,### as the user enter the number.
    Example as the user enter 1-2-3-4-5-6-7, the sequence of number displayed in the text field is:
    1
    12
    123
    1,234
    12,345
    123,456
    1,234,567The user should type only numbers and when he types other than numbers, the field ignore it.
    What I want to see, as the user, for example, types 1-2-3-4-5-t-6-7 is:
    1
    12
    123
    1,234
    12,345
    <beep / ignore> (because t is invalid)
    123,456
    1,234,567
    Thus, I need a guide of what swing components should I use to accomplish this task. If you can give me the code, that will be perfect.
    Hope you can advise me,
    Patrick

  • Wd abap - Input field showing up as yellow on screen

    I've got a problem that is driving me crazy.  On one of my views I have an input field (name, linked to context element type string) that, when you run the application, shows up yellow.  It is one of 6 input fields on the screen, and I can't see any difference between this and the other 5.
    Could someone tell me why this might be happening and what I can do to either stop or control it?  Any assistance would be appreciated.

    Bob,
    One inputfield is active / has focus.
    This is probably the yellow one
    How to set focus actively see:
    IF_WD_VIEW->REQUEST_FOCUS_ON_VIEW_ELEM
    Regards,
    Joris

  • Auto Complete feature in input field

    Hi,
    I had a requirement like user gives the data in input field in the screen. If he start typing the data in input field the list of possible values should display automatically for Eg in google if we type 'A' the list of values will come. The  same thing is possible in Screen or not. I have searched SDN. For web applications it is available. Please help to solve the issue.
    Regards,
    Venkatesh.

    Hey, cor-rel thanks for your time but that didn't work for me.if you some programming solutions or any other please let me know.
    use this link to get more familiar with problem
    http://www.jadooghar.com/AjaxSolrSearch?query=vasant+kunj&what=&type_radio=on&for_radio=on&property_type=Residential&property_for=Sale
    type "vasant kunj" manually in the "where" box 3-4 times so that firefox could generate auto suggestions for you then type "va" firefox will show you the auto complete suggestions. After that focus on auto complete and press "enter" then analyze the result with auto complete and without auto complete i .e manual typing

  • Unbroken writing between 2 different input fields

    Think of a simple journal or diary. This is the feel I am
    trying to emulate in the mc.
    Each page is essentially a different input field so it can
    conform to the feel of writing vertically down the page before
    starting up at the top of the next page. My problem is getting to
    the top of the second page after the bottom of the first page is
    reached.
    I was thinking of an invisible mc at the bottom of the first
    page and set up a hit test between it and the text as it is being
    written. This would then cause a focus shift to the second input
    field comprising the next page, thereby allowing uninterrupted
    'writing'.
    Is this a feasible tactic or is there an easier approach?
    It's a bit of an exotic thing to research, but I've tried anyway
    and haven't come up with anything other than the above theory.
    Thank you.

    Perhaps something like this:
    TF1 and TF2 are textfields. This may not be perfect... I did
    it quickly and didn't check, but I think its the general idea
    TF1.onChanged=function() {
    if (this.scroll>1) {
    TF2.text = this.text.substr(this.text.lastIndexOf(" "))
    this.text= this.text.substr(0,this.text.lastIndexOf(" "))
    Selection.setFocus(TF2);
    Selection.setSelection(TF2.text.length)
    }

  • Cursor not appearing in password input field

    Hi All,
    I know this is probably going to be a bit of a long shot but i have got two fields on the front screen of my web dynpro for abap, with the second field set as a password field.
    When I tab through the fields the cursor apears in the first field but when I press tab again to move to the second password field, although it highlights the field the cursor does not appear so I cant start typing without actually using the mouse to click in the field!
    If i place the password field first or make it a normal input field rather than a password field this problem goes away but obviously these are not valid solutions to this problem.
    Any ideas would be much appreciated.
    Mart
    P.s. i am not 100% certain about this and not sure if it will help with a solution but i believe this bug has only surfaced since we upgraded to the lastest patch level!

    Hi All,
    Before I raise a support ticket with SAP I was just wondering if anyone ever found a solution to this problem. Have managed to put off finding a solution for as long as possible:-( Only solution i have find so far is to capture the user pressing enter and then passing the focus onto the password field but this is not great as the user has to press enter instead of tab which is not particulally intuative.
    Regards
    Mart

Maybe you are looking for

  • How to show excessive values in next page in SAP SCRIPT

    Hello, Please any one can help to show excessive values in next page . For example i want to show 567 5678 789 23456 I want to show values 23456 in next page only. Can anyone please suggest me how to do so? Thanks and regards Mave

  • BPM Parallel Process with Exclusive Gateway

    Hi, I am facing issue with Exclusive Gateway in Parallel Process. Issu is, process always in In-Progress state at parallel Join. I mean process stops at Parallel Join and more over there are no errors in the process. If I delete Exclusive Gateway in

  • Set the value of a object in request scope

    I have the object in my req scope. I need to set value to one of the object attributes if that attribute is blank. How can I set its value. <c:set var="benefitVO" value="${requestScope.BenefitVO}" />I need to set the following Object attribute value,

  • Adding Customer Fields to AS91 - Asset Management

    Has anyone added customer fields to the AS91 transaction. I'm writing a conversion program to load legacy data and I would like to add more fields to the Origin tab.  If I can't do that, then I would like to add another tab to the transaction.  There

  • Why can't I create UDLs?

    Greetings everybody, I'm developing an application with LV7.1 that should communicate (read/write) with Oracle Database. Anyway, I did it succesfully using database connectivity toolset (using Universal Data Link "UDL") So what is the problem? The ve