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
    3
    oklymenko is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Vote Rating
    856
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thank you for the report.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Dec 2009
    Posts
    65
    Vote Rating
    3
    oklymenko is on a distinguished road

      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
    16,941
    Vote Rating
    635
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      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
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Ext JS Premium Member
    Join Date
    Dec 2009
    Posts
    65
    Vote Rating
    3
    oklymenko is on a distinguished road

      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.

Thread Participants: 2

Tags for this Thread