Results 1 to 6 of 6

Thread: [INFOREQ][3.0.0] Form fileUpload:true and htmlEditor

  1. #1

    Exclamation [INFOREQ][3.0.0] Form fileUpload:true and htmlEditor

    If you put in RTE bold string with " (sdfsdf"sdfsdfsdf) you have error in javascript with return data. There is small workaround.

    There is code of test.html

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="" />
    <link rel="stylesheet" type="text/css" href="" />
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">
        var msg = function(title, msg){
                title: title,
                msg: msg,
                minWidth: 200,
                modal: true,
                icon: Ext.Msg.INFO,
                buttons: Ext.Msg.OK
        var fp = new Ext.FormPanel({
            renderTo: 'fi-form',
            fileUpload: true,
            width: 800,
            frame: true,
            title: 'File Upload Form',
            autoHeight: true,
            bodyStyle: 'padding: 10px 10px 0 10px;',
            labelWidth: 160,
            defaults: {
                anchor: '95%',
                allowBlank: false,
                msgTarget: 'side'
            items: [{
                xtype: 'hidden',
                name: 'id'
                xtype: 'htmleditor',
                fieldLabel: 'RichTextExitor'
                xtype: 'textfield',
                fieldLabel: 'Name'
                xtype: 'fileuploadfield',
                id: 'form-file',
                emptyText: 'Select an image',
                fieldLabel: 'Photo',
                name: 'photo-path',
                buttonText: '',
                buttonCfg: {
                    iconCls: 'upload-icon'
            buttons: [{
                text: 'Save',
                handler: function(){
                          url: 'save.php',
                          waitMsg: 'Uploading your photo...',
                          success: function(fp, o){
                              msg('Success', 'Processed file "'+o.result.file+'" on the server');
                text: 'Reset',
                handler: function(){
            <div id="fi-form"></div>

    and save.php

    PHP Code:
    = array();
    $out['success'] = true;
    $out['data'] = $_POST;
    $out['data']['id'] = 1;


  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Sydney, Australia


    Please post more information, see:
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3


    Quote Originally Posted by evant View Post
    Please post more information, see:
    What information do you need?
    All css and javascript files loaded from

    Critical error in Ext.decode after parse response from server if "fileUpload: true" (used iframe). If xmlhttp transport using - there is no bug.

    To reproduce this bug
    1. create test.html file from html code.
    2. create save.php file from php code.
    3. upload it to server with php
    4. put in HtmlEditor text simple"text (any bold text with ")
    5. select any file to upload
    6. press save button.

    Browser versions tested against:
    • IE7
    • FF3 (firebug 1.4.0 installed)

    Operating System:
    • WinXP Pro

    The result that was expected:
    • form is not dirty
    • saved data loaded in form as field values

    The result that occurs instead:
    • critical javascript error

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007


    What are you returning exactly? Show use the exact JSON that you return.

    Do you set the Content-Type header to "text/html"?

  5. #5


    Problem located in document.iframe and javascript. When you read data from body.innerHtml
    and put it to eval('('+document.innerHtml+')'); and all &quot; converted to " and we have string like {data:{name:"test"word"}}.
    You may see it to do some changes for Ext.decode add console.log(json) to see data before eval and look at the Firebug to see clear response from script.

  6. #6
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    The Netherlands


    The API docs are clear on the fact that you need to HTML encode the JSON data, because it is returned as text/html, e.g.
    There is an alternative in Ext 3 if you don't want to HTML encode your response:
    You can return your JSON data as the content of a textarea, e.g.

Posting Permissions

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