1. #141
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    @frederickd

    You are NOT sending the data as an array, you are sending it as a string, so PHP only gets the last data that is sent.

    Let me try to explain again but with a simpler example - one of my own test cases with US State data.

    If I use the following config:

    PHP Code:
    name 'states[]' 
    I get this in Firebug:

    PHP Code:
    states[]    AL
    states
    []    AK
    states
    []    AZ 
    And I get an array of data in PHP's states variable.

    If I use this config:

    PHP Code:
    hiddenName'statesHidden[]' 
    I get this in Firebug:

    PHP Code:
    statesHidden[]    AL
    statesHidden
    []    AK
    statesHidden
    []    AZ 
    And I get an array of data in PHP's statesHidden variable.

    Note the square brackets in both examples - on both occassions, the data arrives on the server as expected.

  2. #142
    Ext User
    Join Date
    Aug 2009
    Location
    Semi-retired in Mexico
    Posts
    47
    Vote Rating
    0
    frederickd is on a distinguished road

      0  

    Default


    Understood. So it must be that the data needs to be defined as an array in the JSON data coming from the server so that it can go back the same way.

    Right now the data is coming from the server as a text field and trying to force it to go back as an array won't work.

    So I have to figure out how to configure my particular field as an array in the JSON data so that it can go back the same way.

    Thanks for your help. I'll see what I can do...

  3. #143
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    Quote Originally Posted by frederickd View Post
    Understood. So it must be that the data needs to be defined as an array in the JSON data coming from the server so that it can go back the same way.

    Right now the data is coming from the server as a text field and trying to force it to go back as an array won't work.

    So I have to figure out how to configure my particular field as an array in the JSON data so that it can go back the same way.
    My example has nothing to do with data coming from the server.

    You could have data come from the server and loaded into the component using a string if you want:

    'AK, AL, AZ'

    Would load Arkansas, Alabama and Arizona into the component.

    Your issue is how you were sending the data to the server. You hadn't used square brackets, which PHP requires to receive the data as an array.

    I'm also guessing (by the additional blank entry) that you are using a regular HTML submit button and not using the BasicForm.submit() method, but that's another topic.

  4. #144
    Ext User
    Join Date
    Aug 2009
    Location
    Semi-retired in Mexico
    Posts
    47
    Vote Rating
    0
    frederickd is on a distinguished road

      0  

    Default


    I don't think I am using an HTML submit button, but maybe I am.

    Code:
    buttons: [{
        text: 'Save',
        type: 'submit',
        handler: function() {
            edit_form.form.submit({
                url: 'http://'+host+'/repairorders/edit_save/'+ edit_select.id,
                waitMsg:'Saving Data...',
                success: function() {
                    Ext.MessageBox.show({
                        title: 'Success Message',
                        msg: 'Data saved successfully!',
                        buttons: Ext.MessageBox.OK,
                        animEl: 'elId',
                        fn: goBackToGrid,
                        icon: Ext.MessageBox.INFO
                    });
                },
                failure: function() {
                    Ext.MessageBox.show({
                        title: 'Failure Message',
                        msg: 'Save failed! Check error messages.',
                        buttons: Ext.MessageBox.OK,
                        animEl: 'elId',
                        icon: Ext.MessageBox.ERROR
                    });
                }
            });                
        }
    I have updated the data in the database to have multiple values, watched it come down from the server as a text field with the multiple values, and defined the hiddenName with [] at the end. The results were not favorable. I will experiment some more. Sorry if I have been frustrating to you. Thank you for your direction.

  5. #145
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    @frederickd.

    Maybe there's an issue that I need to look at with the blank entry.....

    No problem about the questions, it's just a little difficult to follow exactly what you are doing, but the data certainly posts to the server correctly, and can be loaded into the component as an array or a string either by the value config or a call to the setValue method - they both accept an array or delimited string.

    Anyway, good luck with your debugging.

  6. #146
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    218
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    Quote Originally Posted by danh2000 View Post
    Abraxxa,

    Testing q like that isn't advised as a store item with a value of 0 (zero) will fail to query.

    I'll consider it a bug if you can you please post a testcase and describe the problems you are having. Show me some code and some data with an explanation - thanks.
    Sorry for the delay, seems I missed the notification email about your post.

    Thanks for the hint with 0, you're absolutely right.
    I'm using your ux for add and edit forms, the problem occurs in the edit forms.
    I don't set any value when generating the form but load the data with a jsonstore.

    When the loaded (foreign key) value is shorter than minChars the valuesquery isn't triggered.

    I've just found another problem in setValue where null values from the json result in the field getting the string 'null' assigned.
    I've fixed it with the following changes. I'm sure this can be written shorter, the else is to clarify the problem.

    Code:
    setValue : function(value){
            if(!this.rendered){
                this.preRenderValue = value;
                return;
            }
            var values = value;
            if(!Ext.isArray(value) && Ext.isDefined(value)){
                value = '' + value;
                values = value.split(this.valueDelimiter); 
            }
            else {
                values = [];
            }
    Edit: in fact using Ext.isDefined(value) instead of plain value does NOT fix my problem, because Ext.isDefined(null) is true. Using !Ext.isEmpty(value) instead fixes it (note the not in form of an exclamation mark!).

  7. #147
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    218
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    I've rewritten the whole part to be more readable:

    Code:
            // make sure values is an array so later code which assumes that
            // doesn't fail
            var values = [];
            if(Ext.isArray(value)){
                values = value;
            }
            else if(!Ext.isEmpty(value)){
                value = '' + value;
                values = value.split(this.valueDelimiter); 
            }

  8. #148
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    abraxxa,

    Thanks for posting again...

    This post describes what I meant when I asked for some data and code:

    http://www.extjs.com/forum/showthread.php?t=71015

    I'm grateful for everyone posting bug reports, but it's sometimes difficult to understand paragraphs of text, and even more difficult and time-consuming attempting to setup test cases that mimic exactly what someone is doing without seeing their code and data. When I have a reproducible test case, I can fix things much quicker.

    Update: I have created a test case and re-produced the minChars issue. The fix will be in the next version.

    Regarding your second issue, It's could be a good idea to add a check for a null value in the setValue method, but I may be missing something - how does the null scenario occur? Why are you setting the value to null in the first place - what does the data look like?

    Thanks,

    Dan

  9. #149
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    UPDATE 15/01/2010

    Fixed regression that made transforming an HTML Select incompatible with Ext 2.x
    Fixed issue with setValue being used prior to rendering.
    Fix to prevent passing null to setValue from causing problems.
    Fixed inconsistency regarding forceFormValue config and form submits.
    Fix to prevent component submitting values when disabled.
    Fix to ensure that minChars does not affect a values query.

    New version attached to the first post here

  10. #150
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    UPDATE 15/01/2010 (part 2)

    Fix to disable item listeners when component is disabled.

    New version attached to the first post here

Thread Participants: 94

  1. Animal (3 Posts)
  2. jay@moduscreate.com (1 Post)
  3. Condor (1 Post)
  4. stever (1 Post)
  5. mystix (5 Posts)
  6. MD (1 Post)
  7. JorisA (1 Post)
  8. randomY (1 Post)
  9. DigitalSkyline (1 Post)
  10. sj137 (3 Posts)
  11. boggle (1 Post)
  12. danh2000 (71 Posts)
  13. ostghost (1 Post)
  14. lossendae (1 Post)
  15. ZooKeeper (1 Post)
  16. greco (1 Post)
  17. Fredric Berling (1 Post)
  18. GraemeBryce (2 Posts)
  19. Strati (2 Posts)
  20. syscobra (2 Posts)
  21. boonkerz (4 Posts)
  22. Sesshomurai (3 Posts)
  23. shamansoft (1 Post)
  24. dorgan (2 Posts)
  25. mjhaston (1 Post)
  26. radtad (5 Posts)
  27. Joyfulbob (2 Posts)
  28. crysfel (1 Post)
  29. armandoxxx (2 Posts)
  30. jarlau (1 Post)
  31. lacco (1 Post)
  32. abraxxa (38 Posts)
  33. prometheus (1 Post)
  34. pops (1 Post)
  35. raphac (1 Post)
  36. Scorpie (2 Posts)
  37. supercharge2 (4 Posts)
  38. jmiguel (2 Posts)
  39. ash11tw (2 Posts)
  40. wojan (1 Post)
  41. ryzmen (1 Post)
  42. nmohler (2 Posts)
  43. wki01 (2 Posts)
  44. gacowarlock (1 Post)
  45. kora.kanchan (1 Post)
  46. senacle (3 Posts)
  47. genie_vn (1 Post)
  48. sergey.s (1 Post)
  49. Grolubao (10 Posts)
  50. mathec (1 Post)
  51. jackjia (1 Post)
  52. polydyne (1 Post)
  53. Antjac (1 Post)
  54. Thomas Triplet (1 Post)
  55. Gonfi (1 Post)
  56. kleins (1 Post)
  57. talha06 (1 Post)
  58. scishop (1 Post)
  59. eztam (2 Posts)
  60. frederickd (10 Posts)
  61. dusoo (2 Posts)
  62. iv_ekker (3 Posts)
  63. pym (1 Post)
  64. sudhirhv (3 Posts)
  65. lanhun (14 Posts)
  66. wcasado (1 Post)
  67. ramana_l_v (3 Posts)
  68. cq.yangyu@gmail.com (1 Post)
  69. siberian (1 Post)
  70. Tommi (4 Posts)
  71. rdblyth (2 Posts)
  72. devtig (3 Posts)
  73. markmansour (1 Post)
  74. dhiren.lodhia (1 Post)
  75. slamhan (1 Post)
  76. panter4 (1 Post)
  77. Korbin (2 Posts)
  78. istetska (1 Post)
  79. ian.young (1 Post)
  80. sebterzi (1 Post)
  81. ucoxk (1 Post)
  82. prakashr (1 Post)
  83. danilo.pederiva (1 Post)
  84. --miCZar-- (2 Posts)
  85. zozofoz (1 Post)
  86. spydercavern (1 Post)
  87. tvelykyy (1 Post)
  88. leorossi (3 Posts)
  89. revertTS (1 Post)
  90. joxzaren (1 Post)
  91. leduc (1 Post)
  92. deepthi_r (1 Post)
  93. qiankun (1 Post)
  94. Mr.Solomon (2 Posts)