Results 1 to 5 of 5

Thread: Form gets dirty if a textarea field contains a leading line break

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-5389 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Dec 2009
    Posts
    65
    Vote Rating
    4
      0  

    Default Form gets dirty if a textarea field contains a leading line break

    Ext version tested:
    • 4.1.0-beta-2

    Browser versions tested against:

    • IE9
    • Chrome

    Description:
    • If a textarea form field's initial value contains a leading \n line break, that line break is removed and the form is marked as dirty

    Steps to reproduce the problem:
    • create a form panel with a text area field
    • set the textarea's value config to '\nline1\nline2'
    • render the form

    The result that was expected:
    • the text area field shows three lines: <empty>, 'line1', 'line2'
    • form.isDirty() returns false

    The result that occurs instead:
    • the text area field shows two lines: 'line1', 'line2'
    • form.isDirty() returns true

    Test Case:
    Code:
         
    Ext.onReady(function () {
        Ext.create('Ext.form.Panel', {
            frame: true,
            title: 'Leading line break (\\n)',
            width: 350,
            renderTo: Ext.getBody(),
    
            items: [{
                xtype: 'textarea',
                anchor: '100%',
                value: '\nline1\nline2'
            }],
            
            buttons: [{
                text: 'Is Dirty?',
                handler: function(button) {
                    Ext.Msg.alert('Is form dirty?', button.up('form').getForm().isDirty() ? 'yes' : 'no');
                }
            }]
        });

    HELPFUL INFORMATION

    This worked in 4.0.7

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    Thank you for the report.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Ext JS Premium Member
    Join Date
    Dec 2009
    Posts
    65
    Vote Rating
    4
      0  

    Default

    This bug was reported as fixed on the RC1 release notes, but the scenario described here is still broken in RC1 & RC2.

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,608
    Vote Rating
    874
      0  

    Default

    FYI this is fixed in 4.1.0 final. You also raised another issue with regards to carriage returns, it will be fixed in 4.1.1.

    The problem is that some browsers will automatically strip out '\r', so when you get the value out of the field it appears as though it's dirty. To normalize it, we now strip out every '\r' when setting the value, since we can't reasonably try and re-insert the '\r'.
    Evan Trimboli
    Twitter - @evantrimboli

  5. #5
    Ext JS Premium Member
    Join Date
    Dec 2009
    Posts
    65
    Vote Rating
    4
      0  

    Default

    It appears that the scenario from this bug as well as a similar scenario described here are still broken in IE8. Tested in 4.1.1 GA.

Tags for this Thread

Posting Permissions

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