Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    AutoFocus

    My form has autoFocus=true. When I resetValues(), the form is redrawn() but the focus doesn't get placed on the first field.

    Shouldn't it?

    I'm manually calling form.focusInItem(0) to resolve this for myself.

    It'd be nice if autoFocus selected the contents of the field as if I tabbed into it, rather than placing the cursor at the end.

    -----

    I just noticed that FireFox puts the cursor at the end and IE puts the cursor at the beginning of the field. I want the value selected for replacement.

    -----

    I'm seeing a log warning in both IE and FF: "DynamicForm:isc_DynamicForm_54:couldn't find focus item: undefined" yet the focus is placed in the first field.
    Last edited by tgochenour; 6 Feb 2007, 15:04.

    #2
    Hi tgochenour,
    1: autoFocus set to true is designed to ensure that when a user is shown a form (in other words the form is either drawn onto the page or made visible when it previously wasnt present), the form will automatically receive focus.
    This property is not intended to focus on values change via setValues() or resetValues().
    We could add that feature but it's not clear whether this is the desired behavior in most cases - seems like it really depends on the application in question.
    Your approach of manually calling focusInItem() [or form.focus()] to put focus into the form item is appropriate in this case.

    2: Thanks for the heads up on this - we'll be making sure that an option to select the text in response to a focusInItem() call gets into the libraries for our next release.
    If this is being really frustrating for you, contact us at support@isomorphic.com and we may be able to give you a temporary workaround until this functionality makes it into the product.

    3: You should be able to safely ignore this warning in the 5.5.1 build.
    It's an over-zealous warning that is currently tripped in some cases when there is nothing to be concerned about - we'll be fixing this for future releases.

    Isomorphic

    Comment


      #3
      I've just noticed that if my first field in a form is a picklist, the autoFocus doesn't set upon this field.

      Comment


        #4
        Hi
        I'm not seeing the problem you describe with autoFocus failing to work for a form whose first item is pickList-based.
        I tested with both a select item and a comboBoxItem.
        My test code looked like this:

        Code:
        isc.DynamicForm.create({
            top:100,
            ID:"randomForm",
            items:[
                {type:"text", name:"foo"}
            ]
        })
        isc.DynamicForm.create({
            top:200, backgroundColor:"red",
            ID:"testForm",
            autoFocus:true,
            items:[
                {editorType:"select", valueMap:["a","b","c"], name:"foo"}
            ]
        })
        
        isc.DynamicForm.create({
            top:300,
            ID:"randomForm2",
            items:[
                {type:"text", name:"foo"}
            ]
        })
        When I load a page with this block, focus goes to the select item in the red form, as expected.
        Are you still seeing this issue? Do you have a test case we could look at?

        Thanks for your help

        Isomorphic Software

        Comment

        Working...
        X