Announcement

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

    FormItem canFocus

    Is there any equivalent of canFocus for formItems? I'm thinking I may need to override "focus" to return false but I don't really want to do that unless I really have to. I've tried the following code but the fields still receive focus when I tab through the elements

    Code:
    
    isc.DynamicForm.create({ID:"account$gridWrap",width:150,titleSuffix:" ",titlePrefix:"",
    canFocus: false,titleOrientation:"top",rightTitlePrefix:"",requiredTitleSuffix:"*",
    requiredRightTitleSuffix:"*",requiredRightTitlePrefix:"",fields:
    [{title:"<nobr>Account Number&nbsp;<\/nobr>",titleStyle:"textBodyLight",width:150,
    ID:"account",name:"account"
    ,canFocus: false,errorIconSrc:"\/cwf\/r\/cwfv\/error.png",_constructor:"TextItem"}]});
    
    isc.DynamicForm.create({
        ID: "boundForm",top:200,
        fields: [
    {name: "password",canFocus:false, _constructor: "TextItem"},
            {type:"text", name:"testtext"}
            ]
    
    });

    #2
    A disabled field does not accept focus and will be correctly skipped over when tabbing.

    Just returning false from focus() will have various unexpected results.

    Comment


      #3
      Unfortunately, we cannot use disabled flags because we have a requirement to be able to copy the text within a disabled field. So our workaround is to make it look like a disabled field, and suppressing keypress. Any other suggestions?

      Comment


        #4
        OK, there is a FormItem.canFocus that you could set to false. We can document that it is legal to do this, but would not be legal to set canFocus:true on an item where there is nothing to focus on (eg Blurb).

        Comment


          #5
          I've tried that in my example above. It doesn't work. Maybe there's something else I'm missing in my code?

          Comment


            #6
            Ah, looks like there's a reason it's not documented.

            What we'd recommend as a workaround is that when focus() occurs, you manually call focusInItem() to move focus to the next or previous item in the form, according to whether it's a tab, shift-tab or mouseDown.

            Comment


              #7
              why does smartclient not provide this functionality?

              Comment


                #8
                Actually, read-only capability is planned for a future release so you can mark the field that way and it will allow copy but not changes.

                Comment

                Working...
                X