Focusing a text field

Hi,
I have an input field in a view. This field is not getting focused when the view appears. What I mean is the cursor is not appearing in the field when the view appears and once the user taps on the field, it is focusing. So without tapping, how we can acheive this functionality.
Regards
MQ

get the AttributeInfo of the Context Node represented by the form element.
IWDAttributeInfo attribute = wdContext.nodeA().getNodeInfo().getAttribute(A.theattribute);
wdThis.wdGetAPI().requestFocus(currentAElement(), attribute);
(assuming you an element named A with an attribute called "theattribute")
Hope that helps
Jan

Similar Messages

  • Text Area steals Focus from Text Field when selected with mouse

    I have created a very simple form with 4 spry validation elements here :: http://octopusdesign.net/contactus.html
    When I attempt to select the 'Your Email' text field using the mouse, focus is grabbed by the text area above it.
    It is only possible to get focus on the 'Your Email' text field by using tab.
    My best guess is that this is a bug in the framework.
    In addition to updating my spry libraries to 1.6 from 1.4 I've tried the following things::
    Reordering the elements in the form.
    Creating the elements in a different order.
    Replacing the validation elements with ordinary elements.
    None of these fixed the problem.
    Strangely, if I remove the validation text area there is no problem.
    If anyone can shed some light on this I would really appreciate it.
    Wisdom gratefully received.
    Chris

    Furthermore ::
    I've tried to reconstruct the form from scratch and discovered that if you have a validation text field and a validation text area in any order on the form, selecting the 2nd element with the mouse always results in the first element stealing the focus.

  • Assign focus on text field associated with tree item in edit mode

    The JavaFX home page has an example for how to edit the label associated with a tree item using a cell factory (see sample code below). However, if you select a tree item and then either mouse click or select the Enter key to start editing, the text field doesn't get focus even though the startEdit() method invokes textField.selectAll(). I tried invoking textField.requestFocus(), but that didn't work. Is there a way to ensure that the text field gets focus when the tree item is in edit mode?
    I'm using JavaFX 2.1 GA version on Windows 7.
    Thanks.
    Stefan
    @Override
    public void startEdit() {
    super.startEdit();
    if (textField == null) {
    createTextField();
    setText(null);
    setGraphic(textField);
    textField.selectAll();
    public class TreeViewSample extends Application {
    private final Node rootIcon =
    new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    private final Image depIcon =
    new Image(getClass().getResourceAsStream("department.png"));
    List<Employee> employees = Arrays.<Employee>asList(
    new Employee("Ethan Williams", "Sales Department"),
    new Employee("Emma Jones", "Sales Department"),
    new Employee("Michael Brown", "Sales Department"),
    new Employee("Anna Black", "Sales Department"),
    new Employee("Rodger York", "Sales Department"),
    new Employee("Susan Collins", "Sales Department"),
    new Employee("Mike Graham", "IT Support"),
    new Employee("Judy Mayer", "IT Support"),
    new Employee("Gregory Smith", "IT Support"),
    new Employee("Jacob Smith", "Accounts Department"),
    new Employee("Isabella Johnson", "Accounts Department"));
    TreeItem<String> rootNode =
    new TreeItem<String>("MyCompany Human Resources", rootIcon);
    public static void main(String[] args) {
    Application.launch(args);
    @Override
    public void start(Stage stage) {
    rootNode.setExpanded(true);
    for (Employee employee : employees) {
    TreeItem<String> empLeaf = new TreeItem<String>(employee.getName());
    boolean found = false;
    for (TreeItem<String> depNode : rootNode.getChildren()) {
    if (depNode.getValue().contentEquals(employee.getDepartment())){
    depNode.getChildren().add(empLeaf);
    found = true;
    break;
    if (!found) {
    TreeItem<String> depNode = new TreeItem<String>(
    employee.getDepartment(),
    new ImageView(depIcon)
    rootNode.getChildren().add(depNode);
    depNode.getChildren().add(empLeaf);
    stage.setTitle("Tree View Sample");
    VBox box = new VBox();
    final Scene scene = new Scene(box, 400, 300);
    scene.setFill(Color.LIGHTGRAY);
    TreeView<String> treeView = new TreeView<String>(rootNode);
    treeView.setEditable(true);
    treeView.setCellFactory(new Callback<TreeView<String>,TreeCell<String>>(){
    @Override
    public TreeCell<String> call(TreeView<String> p) {
    return new TextFieldTreeCellImpl();
    box.getChildren().add(treeView);
    stage.setScene(scene);
    stage.show();
    private final class TextFieldTreeCellImpl extends TreeCell<String> {
    private TextField textField;
    public TextFieldTreeCellImpl() {
    @Override
    public void startEdit() {
    super.startEdit();
    if (textField == null) {
    createTextField();
    setText(null);
    setGraphic(textField);
    textField.selectAll();
    @Override
    public void cancelEdit() {
    super.cancelEdit();
    setText((String) getItem());
    setGraphic(getTreeItem().getGraphic());
    @Override
    public void updateItem(String item, boolean empty) {
    super.updateItem(item, empty);
    if (empty) {
    setText(null);
    setGraphic(null);
    } else {
    if (isEditing()) {
    if (textField != null) {
    textField.setText(getString());
    setText(null);
    setGraphic(textField);
    } else {
    setText(getString());
    setGraphic(getTreeItem().getGraphic());
    private void createTextField() {
    textField = new TextField(getString());
    textField.setOnKeyReleased(new EventHandler<KeyEvent>() {
    @Override
    public void handle(KeyEvent t) {
    if (t.getCode() == KeyCode.ENTER) {
    commitEdit(textField.getText());
    } else if (t.getCode() == KeyCode.ESCAPE) {
    cancelEdit();
    private String getString() {
    return getItem() == null ? "" : getItem().toString();
    public static class Employee {
    private final SimpleStringProperty name;
    private final SimpleStringProperty department;
    private Employee(String name, String department) {
    this.name = new SimpleStringProperty(name);
    this.department = new SimpleStringProperty(department);
    public String getName() {
    return name.get();
    public void setName(String fName) {
    name.set(fName);
    public String getDepartment() {
    return department.get();
    public void setDepartment(String fName) {
    department.set(fName);
    Edited by: 882590 on May 22, 2012 8:24 AM
    Edited by: 882590 on May 22, 2012 8:24 AM

    When you click on a selected tree item to start the edit process is the text in the text field selected? In my case the text is not selected and the focus is not on the text field so I have to click in the text field before I can make a change, which makes it seem as if the method call textfield.selectAll() is ignored or something else gets focus after method startEdit() executes.

  • Why do HOME and END ignore focus in text fields?

    I just noticed that the HOME and END keys seem to ignore focus in a text field on webpages.
    Normally, they go to the beginning and end of a webpage, which is perfectly fine with me. And in fact it's quite useful on really really long webpages.
    However, when my cursor is in a text field (“focused”), I expect HOME to go to the beginning of the line and END to go to the end of the line. However, this is not the case.
    1. Does anybody know why this is the case?
    2. Does anybody know if this can be changed to my desired behavior?

    Well, I'll be damned!
    I feel a bit sheepish, but I'd never noticed that that was the way Home and End worked everywhere. For some reason I had assumed it was Safari-only. Once I read your post, I was purposely mindful about the keys I was using, and I realized that I'd learned to automatically use ⌘← and ⌘→ when editing text elsewhere. Weird.
    I think this probably arose from the fact that my first Apple computer was a laptop, and since Home and End are built into the arrow keys on the smaller keyboard, I suppose it was enough to mask the difference.
    *Follow-up question:*
    Is there a technical / usability / official reason for this discrepancy? I remember being taught the function of Home and End in computer classes in Elementary School (late 80s and early 90s for me). Some of the computers in these classes were Apple and some where PCs. (I acknowledge that Apple during that time is not the same as Apple after Steve Jobs returned as CEO, but if the cause of this difference is Apple vs. Microsoft related, then I thought it was possibly relevant.)

  • Setting Focus in Text Field of Dynamic Form

    I have a form that has a dynamic section that allows a user to add or delete a request. It this form there is by default one request. At the end of the section I have a button that says "ADD ADDITIONAL REQUEST" that will load another instance of the repeatable section. I want to be able to fill out the first request and click on the ADD button and when the new repeatable section displays the cursor should be active in the first text field of the new instance. Does anyone have any idea how to do this? Thanks in advance for the help!

    You can check to see if it contains a string once by using the contains function, but there isn't a very clean way to do what you want. If you wanted to guess at the maximum number of occurrences, then you could:
    Box A has your initial. Set Box B to do a concat of string-before and string-after of Box A where it copies Box A minus the string we're looking for. Then we have Box C that does the same thing to Box B. Repeat as many times as you see necessary.
    Example:
    String: "1"
    Box A - "123451234512345"
    Box B - "23451234512345"
    Box C - "2345234512345"
    Box D - "234523452345"
    etc.
    We then have a field that has nested ifs looking backwards from Z -> A looking for a non-blank. Based on that, we return the number of occurrences. Again, this isn't clean, but it will work if you think there's a predefinable maximum.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • Focus in text field

    Our client wants to make a change to a Forms 6 app so that when he goes to a text field (either by mouse or TAB from previous field), the existing value should be highlighted to that the first key stroke will start overwriting the previous value. This is how excel works.
    Right now, whenever he lands in a text field, it is in edit mode and he must first delete the value with backspaces and right/left cursor movements before entering a replacing value.
    Thanks.

    Forms is not excel. There is nothing like a "edit"-mode. The default-behaviour is, when you tab into a field, the whole content is "selected", and when you start typing the "old" value will be erased. The only way i know that not to happen is, as already mentioned, to set "Keep Cursor Position" to "Yes", which is not the default.

  • Cursor focus in text fields in Safari broken after Snow Leopard upgrade

    Hi, I just upgraded from Leopard to Snow Leopard on my Macbook. Since then, whenever I am typing in a text field in Safari (e.g. Gmail's compose message contents field), the cursor freezes. I cannot move the cursor with either arrow keys or the mouse. I cannot select text. The only way to move the cursor is to click on a different text field (e.g. the email subject field in Gmail) and then click back on the location I want in the first text field. But even after that, I cannot move the cursor within that field aside from typing characters -- I still have to click back and forth between different text fields.
    I have not had this problem in Firefox.
    This seems like a minor thing but it makes Gmail unusable in Safari, which basically means Safari is useless to me now. Still, I prefer to use Safari for general web browsing since it is much quicker, so I am hoping someone can recommend a fix (preferably not going back to Leopard, although that is an option via a SuperDuper restore).

    HI,
    Other Safari users have experienced this issue but the issue resolved itself after uninstalling the Flash player plugin, then reinstalling, then repairing permissions.
    Go here and follow the instructions. Uninstall Flash
    Install the most recent version of Flash here.
    Now repair permissions.
    Launch Disk Utility. (Applications/Utilities) Select MacintoshHD in the panel on the left, select the FirstAid tab. Click: Repair Disk Permissions. When it's finished from the Menu Bar, Quit Disk Utility and restart your Mac. If you see a long list of "messages" in the permissions window, it's ok. That can be ignored. As long as you see, "Permissions Repair Complete" when it's finished... you're done. Quit Disk Utility and restart your Mac.
    Carolyn

  • When does a selection in a text field in a Finder window lose focus?

    Hello,
    this problem has emerged on account of an Applescript file that needs to access a text selection (portion of a filename highlighted) in an open Finder window.
    The bare minimum code to demonstrate the problem is this:
    *tell application "System Events"*
    * *tell process "Finder"*
    * *set selText to value of attribute "AXSelectedText" of text field 1*
    * *end tell*
    *end tell*
    other variants also exist, using "keystroke" but that does not work either. I am not asking help with Applescript here, it is here only to give a sense of the problem.
    My conclusion thus far is that the selection lose focus before the script process can access it. In the best case I get the full filename by using "attribute" and copy of the alias onto the clipboard by using "keystroke".
    So my problem is this:
    It seems that the focus stays alive when one clicks on a menubar item, any click on any other item on the desktop, including windows of irrelevant applications, changes the focus from the selection within the text field corresponding to a filename, to the filename itself.
    And my question is this:
    Is there a changeable setting within the OS that has to do with how long the focus stays alive on a selection within a text field corresponding to a filename? If yes, how do I change it?
    Thanks

    baltwo wrote:
    Thanks for clarifying. Never heard it called a text field, just a label. So, exactly what are you trying to accomplish? Is it that you want AS to select the file, highlight its label so you can edit/change it with some other text? If so, have you checked out the Finder scripts installed on the machine, especially the Finder script *Add to Finder Names*?
    UI Element Inspector calls the activated/editable filename a text field.
    Actually I want to modify one of the stock Finder scripts. I want to be able to select part of the file name in the active text field of the Finder window, then activate the script, *have the script pick up the selection* as a text string then use it internally.
    The bolded step is the one in question.
    Every attempt fails on the fact that the focus is lost from the "text field" and it reverts to the label for the filename, if I may use this distinction, (or to "FinderItem" in the parlance of UIEI) as soon as another process begins, it seems. So when the script becomes active, but before any of the commands is executed, the selection disappears.
    My guess is that it is not some absolute necessity but a setting that perhaps can be changed somehow.

  • Setting the focus to a text field on a subform in the form initialize event.

    I have a form that checks the rawValue of a text field to determine whether or not the focus should be set on a particular text field. Here is the logic:
    if(txtEmailVisible.rawValue == "visible")
    frmEmailData.presence = "visible";
    xfa.host.setFocus(xfa.form.NEDA.main.frmEmailData.txtEmailBody);
    else
    frmEmailData.presence = "hidden";
    For some reason the focus isn't going to that object, instead it is still going to the first field in the tabbing order. Am I calling this in the wrong event, which is causing the tabbing order to over ride my setFocus call?
    Thanks,
    Chad

    Try using setTimeout for this from the DocReady event.
    app.setTimeout("xfa.host.setFocus(xfa.form.NEDA.main.frmEmailData.txtEmailBody);
    ", 250);
    There are several occasions where code must be executed after init/formReady/DocReady, etc. has been completed. This is one of them.

  • Can I keep the scrollbar visible in a text field once focus is lost?

    Hi there,
    I am pre-loading a text field with a large amount of text and making it read-only so that the user can scroll and read.  So essentially I'm not using it for text entry but simply as a scrollable text area as I couldn't find a simpler way to achieve this.
    Only problem is our client doesn't like the fact that the scrollbar doesn't appear until you click into the text field and disappears again when the field loses focus.  It is not immediately clear that there is a large amount of text and that the user needs to scroll to read it all.
    Is there a way of making the scrollbar visible at all times, or is there a better way of implementing a scrollable text area?
    Many thanks,
    Kieran

    Here are my answers..
    1) Is there any way I can programmatically force the scrollbar to be visible at all times?
    Srini: I do not think that is available.
    2) Do you know of any other way to implement a read-only scrollable text area?
    Srini: Make the TextField Type to Protected/ ReadOnly to hold the ReadOnly text and make it Allow Multiple Lines. (I think you did the same)..Usually if you have a long text inside a text field with scrollbar, if the user tries to print, it will only print what ever is visible. So it would be better to check the "Expand to Fit" for Height in the Layout tab and "Allow Page Breaks with in the Content" for TextField (if possible) or the Subform/ Table/ Row that holds the TextField.
    Thanks
    Srini

  • Updated - Cursor focus in HTML text field in JEditorPane

    The last poster just save my bacon - so an update for others: Adding a JEditorPane to a JWindow will result in all the <INPUT type=text> form elements to be non focusable. Switching to JFrame does make things work again - but I would love to have a JWindow again (I don't want the title bar for a kiosk type operation).
    thanks!
    brian
    Here is the guy I do thank!!!
    ** PROBLEM
    How do I make cursor focus go into an HTML text field in a JEditorPane?
    My test appplication is a JPanel containing a JEditorPane and nothing else. The content type is text/html. The HTML text contains a form and an INPUT TYPE=TEXT tag. I use setEditable(false) because I do not want the user to edit the paragraph text, only to type in the text field.
    The text field does not get cursor focus. Tab does nothing. The user can click with the mouse to place focus in the text field, so the field is capable of receiving focus. I guess the field is in a View that stops it participating in the component hierarchy.
    Is there a way to make this work?
    ** SOLUTION! - ok, if you don't use JWindow
    It turns out that setEditable(false) is not enough. The JEditorPane still gets in the way of the focus cycle. It also needs setFocusCycleRoot(false) and setFocusable(false) to prevent it from participating in focus. Focus on the text field then works normally.
    fp

    I don't want the title bar for a kiosk type operation).You could use an undecorated frame. Read the API for more info.
    Or, maybe this posting will help:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=675445

  • IPhoto text field input focus requires mouse hover

    This is driving me crazy. To add text to a photo title or description, the mouse must not just click in the text box -- it must stay there! If the mouse drifts away after the click or you bump the mouse while typing, text input stops. This is seems peculiar and turns out to be quite frustrating. This reminds me of the old days when there was a debate over window focus and mouse movement.
    Once you click into a text field, that field should stay active until you do something intentional to leave it (tab, enter, click, etc.).

    I'm having the same problem as you with dealing with text. After some hours of trying all kinds of clicking around and holding down extra keys (the arrow keys help a bit), I'm getting nowhere. I was automatically upgraded to 9.1.1 when I got my new MacBookPro. I was previously on an older version of iPhoto. The description pane in the older version was bigger and much simpler to use (there is spare space on the iPhoto 9.1.1 screen layout, so why did Apple make its description panel so small?). Version 9.1.1 has more editing options, but I haven't yet found a way of using most of them because as you say, it's so difficult to keep selected text active for editing.
    I have also tried drafting my descriptions inside Word first and then pasting them into iPhoto. They paste OK but the pasted text is black (as in Word) - but against the near-black of the iPhoto description pane, it's almost invisible! I thought I could then change the pasted text colour in iPhoto to white (on black) by using 'colours' from inside the description-editing options of iPhoto, but for the above reasons, I can't find any way of doing that.
    There seems to be no direct help for these problems in iPhoto Help. Has anyone out there worked out what the select-and-edit routines should be? If not, I just hope Apple will solve these things in the next upgrade, or at the very least give us a bigger text pane.
    Message was edited by: digidaze

  • Cursor not focusing in the text field after Object tag load in IE

    Hi,
    We have an applets class "ABC.class" in our application. To include this class in a jsp page we are using OBJECT tag. This tag is written inside a if block in the jsp page. Based on the if condition this OBJECT tag has to be loaded. Below is the code we are using:
    <%
    if(testCondition)
    %>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" NAME="applet" width="0" height="0">
    <PARAM NAME="CODE" VALUE="ABC.class" >
    <input type="hidden" id='myText' value="Please configure the jinitiator version to Oracle applicaitons Jinitiator version." >
    No JDK 1.3 support for APPLET!!
    </OBJECT>
    <%
    %>
    In the above code if the "if condition" is satisfying, then cursor is not focusing on the required field. The code to focus on the field is written in the javascript function which is called onLoading the page.
    we are using IE 7 and IE8. In IE 7 sometimes working fine but in IE 8 we are getting this issue.
    Can anyone please help us how to focus the cursor on the required field even in the case of the Object tag loading.
    Thanks,
    Eswari

    Hi Nicky,
    Thanks for your reply.
    We are not using JQuery.
    Actually the code to focus is written in the function which is called onLoad of the page that will be executed after the page loading. If we keep alerts in the onLoad function then the cursor is focusing to the required field.
    Thanks,
    Eshwari

  • How do I set focus to a text field after I click a button that calls a webservice?

    I have a web service that returns back a table. In order to show the values in the table I had to check the re-merge Form Data on the Webservice Button.  My question is , How do I set focus to a field on the screen after re-merge happens.

    I was reading SetFocus documentation and it says
    You cannot use  setFocus with the form:ready, layout:ready, or initialize events.
    What I need is an event like doc:ready or someother event where I can put the set focus code in. doc:ready was triggered when the form first loads which is great and I was able to put my Initial setfocus. When I pressed the button that calls the webservice and thr re-merge happened doc:ready event was not triggered so now I am not sure where to put the set focus.

  • Change the font color of a text field in a table by key-combination

    I want to change the font color of a text field in a table (single cell only) on pressing a key combination. Does anybody know how to do this.
    I have a lot of data in a table. During an evaluation of the data in a meeting I want to change the color of the text depending on the result of the meeting. (for example: High risk = CTRL+R makes the text red).
    I know how to change the color using a button, but I do not want to add a button after each cell. For this reason I would like to do it on a key combination that alway refers to the active cell.
    Many thanks for your help in advance.
    Marcel

    Hi,
    I don't think you can use the ctrl key like that as those shortcuts will be intercepted by Reader (ctrl-R toggles the ruler display on / off).  You also might have trouble updating the color while you still have focus on it.  You can use the shift key in a similar way, so if you only have lower case characters in the text fields then you can do something like;
    if (xfa.event.shift)
        switch (xfa.event.change)
            case "R":
                this.fontColor = "255,0,0";
                break;
            case "O":
                this.fontColor = "255,102,0";
                break;
            case "G":
                this.fontColor = "0,255,0";
                break;
        xfa.event.change = ""; // ignore character
    If you need uppercase characters maybe you can have one button to set "review mode" and test that on the if (xfa.event.shift) line.  But again it wont take effect until you have tabbed out of the field.
    Regards
    Bruce

Maybe you are looking for

  • InfoCube Data Modeling "Or" combination Result Set

    Hi All, I am new to BW so please let me know if this is something that can be done without too much complexity. How would one go about tackling an issue like this. Below is the sales ODS data. <u>Sales ODS Data</u> Customer - Sales $ - Rebate Indicat

  • Can't see printers on TC

    I have a TC connected by ethernet cable to my main wireless Linksys router. The first iMac is attached to it via ethernet cable. The second iMac ws just added and is attached to the Linksys router via ethernet cable. There is an HP Laserjet 5M attach

  • Creating file shortcuts / aliases like installer

    The AIR installer creates shortcuts to the app in the Start menu and optionally on the Desktop on Windows... our app needs this same functionality to create shortcuts (Win) or aliases (Mac) and set the parameters for the shortcut/alias. Ideally there

  • HT201272 my music is missing how can i get it back?

    hello?

  • Webutil Initialization

    Premise: Created a form that utilizes webutil objects. Oracle forms 10g from Oracle Developer Suite 10g 10.1.2.0.2. I used the webutil.pll and webutil.olb provided in the software. Furthermore, the application server is on a different country from wh