Results 1 to 6 of 6

Thread: Best Way to Include Non-editable text field in form?

  1. #1
    Ext User
    Join Date
    Sep 2010
    Posts
    33
    Vote Rating
    0
      0  

    Default Best Way to Include Non-editable text field in form?

    Hi,

    I'd like to include a non-editable text field (with label) in a FormPanel and was wondering what the best way to do that is?

    I tried adding a text field to form but there does not seem to be a way to make it non-editable.

    code....

    {
    xtype: 'textfield',
    name: 'price',
    id: 'confirm-buy-price',
    label: 'Price',
    },

  2. #2
    Touch Premium Member
    Join Date
    Oct 2010
    Posts
    93
    Vote Rating
    1
      0  

    Default

    I Use, unless someone else has a better way
    Code:
    {
                xtype: 'textfield',
                name: 'spnactName',
                label: 'Name',
                showClear: false,
                listeners: {
                    'afterrender': function() {
                        this.fieldEl.dom.readOnly = true;
                    }
                }
            },

  3. #3
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Vote Rating
    1391
      0  

    Default

    Do you want to enable and disable the readonly status? Or just have a non-editable field for good? If you do not want to be able to enable the field then why not just use the Ext.form.Field?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #4
    Ext User
    Join Date
    Sep 2010
    Posts
    33
    Vote Rating
    0
      0  

    Default

    Readonly status is fixed (disabled only). Is there an xtype for Ext.form.Field?

  5. #5
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Vote Rating
    1391
      0  
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #6
    Sencha User
    Join Date
    Dec 2015
    Location
    Norther Virginia
    Posts
    15
    Vote Rating
    0
      0  

    Default

    Im about 6 years late on this but in case anyone finds this thread as I did looking for this answer, I found a perfect solution to display text within the form but make it non-editable and still have the same look and feel as the rest of the form....

    Code:
    {
       xtype: 'displayfield',
       fieldCls: 'x4-form-text x4-form-field'
    }
    acheived using the native classes within extjs

Similar Threads

  1. Rendering HTML in editable form field
    By JoshS in forum Ext 3.x: Help & Discussion
    Replies: 11
    Last Post: 18 Oct 2010, 1:07 AM
  2. text after a form field
    By bom1310 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 9 Dec 2009, 4:29 AM
  3. how to get text field value using form id
    By karim480 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 16 Apr 2008, 4:52 AM
  4. FF can't select text in form text field
    By zonereseau in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 11 Apr 2008, 10:54 AM
  5. Editable form text field
    By kenITR in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 1 Feb 2008, 9:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •