Announcement

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

    Create a Read-Only field

    I'd like to create a Read-Only date field, however I can only see instructions on disabled fields. That is read only like in html:

    Code:
    <input readonly="readonly" name="readonly-field" type="text">
    Is it possible to create Read-Only fields in Smart Client?

    #2
    Will using a StaticTextItem provide the functionality you need? This will render the date according to the specified dateFormat.

    Comment


      #3
      Thanks, I had considered that. But I need the field to be editable under certain conditions. Is there a way of changing a DateItem to a StaticTextItem on-the-fly?
      Last edited by Joe.Fowler; 31 Mar 2008, 23:24.

      Comment


        #4
        Any possibility of this?

        Comment


          #5
          Originally posted by Joe.Fowler
          Thanks, I had considered that. But I need the field to be editable under certain conditions. Is there a way of changing a DateItem to a StaticTextItem on-the-fly?
          You could create a hidden DateItem and a StaticTextItem, so that when you want to edit the date, you just hide the StaticTextItem and show the DateItem. Why not just do that?

          Comment


            #6
            A StaticText doesn't provide the same functionality as a read only TextField:
            1. Display the skin border for the TextField. This provides the correct visual feedback, specially when the value is missing;
            2. Display the caret (text cursor) and allow the user to scroll text contents larger than the control;
            3. Ability to change the read-only property dynamically. This is the most important feature that is missing in SmartClient.

            I'm using vers6.0 and this issue was not fixed. The readOnly property should be IRW and must work for both DynamicForm and editable grid fields.

            Currently setting the readOnly property at instantiation creates a control that behaves like a StaticTextField with a TextField border. There's no caret and the control is not made editable by setting the property true.

            Anybody can post a tested workaround for readonly fields in DynamicForms and/or Grids? I'll look at using 2 fields, only one displayed at a time, but I guess this will only work for forms, not for grids.

            Comment


              #7
              Hi CatalinMerfu,

              In a form, two versions of the field work. In a grid, an override of canEditCell() can provide dynamic editability, and a call to refreshCell() will switch the cell between editable and non-editable presentations.

              Rendering a non-editable value as a reaadonly text field is a good enhancement and one that is being considered for future versions of SmartClient. Of course everyone's priority list looks different :) You can always sponsor enhancements to SmartClient to have them done on your timeline and to ensure they meet your needs - contact us here about that.

              Comment


                #8
                Thanks,

                I hope you can make this fix a priority. You already have the enabled/disabled property and the readonly property is also a basic functionality for a widget framework.

                I would have used disabled items with the showDisabled property set to false. But showDisabled doesn't work for text items. I think this is a bug as it works for select items.

                Comment


                  #9
                  Works for me:

                  Code:
                  isc.DynamicForm.create({
                      fields : [
                           { type:"text", disabled:true, defaultValue:"value" }
                      ]
                  })
                  Are you referring to the fact that you can't scroll, copy and paste from a disabled field?

                  Comment


                    #10
                    My understanding for the showDisabled property is that the disabled control is displayed normally (not grayed) even when the control is disabled.

                    The color of the text for a disabled control is gray but for a readonly control is black. For the select control the text color is black when disabled and showDisabled property is true. But the drop down button is still grayed.

                    Indeed you couldn't set focus on a disabled control even if displayed normally but the only reason you would want that is to scroll large data. Maybe this would not be a solution for a TextArea control.

                    Comment


                      #11
                      Hi catalinmerfu,

                      disabled:true actually disables the control. showDisabled affects only what CSS style is applied to a disabled control. Text, icon and border should all go grey, if they do not, that may indicate an incorrect CSS style. If you haven't customized styling at all, please let us know which skin you're seeing this in.

                      On read-only controls - you do know that you can cancel all user changes via returning false to the change() event? It does make sense to build this into all controls, however, you could create a dynamically settable readonly attribute yourself this way.

                      Comment

                      Working...
                      X