-
15 Jan 2010 2:12 AM #151
Hi Dan!
I assumed that bug report policy is only for ExtJS itself, but if you use it too that's fine for me.
As a developer I appreciate good bug reports myself.
Thanks for fixing the minChars issue!
@null value problem: I'm using (and am co-author of) Catalyst::Controller:
BIC::API which returns all object attribute/value pairs of an object, also undefined ones.
My JSON is something like:
Do you need a more detailed explanation?Code:{ "success":true, "data":{ "id":"123", "fk_foo":null, "bar":"baz", } }
-
15 Jan 2010 3:44 PM #152
-
15 Jan 2010 4:14 PM #153
UPDATE 16/01/2010
Fixed bug when setting disabled in config.
Updated CSS to remove gray background from input when component is disabled.
New version attached to the first post here
-
15 Jan 2010 4:36 PM #154
UPDATE 16/01/2010 (Part 2)
Fix to prevent extra empty hiddenName value from being posted.
@frederickd - I'd forgotten about this one until I saw you on the forum
New version attached to the first post here
-
15 Jan 2010 5:25 PM #155
@danh2000
Thank you for the post and the update! I have just installed and there is a difference for me. Here is my JSON data coming from the server.
Notice that the "services" entry has two values. (I have a valueDelimiter: ", " (comma + space) so have set up the data that way too.) Attached is a screen shot showing that both values display in the combo box, plus a space for the user to type in characters for a new selection instead of using the drop down.Code:{"Repairorder": {"id":"150", "advisor_id":"1", "dealer_id":"1", "distributor_id":"1", "number":"RO20100107b", "servicedate":"2010-01-07", "vin":"5TDZT34A05S250524", "year":"2008", "make":"Toyota", "model":"4-Runner", "odometer":"13456", "odometer_type":"Miles", "created":"2010-01-07 17:21:28", "modified":"2010-01-15 17:00:48", "lof":"Premium", "lof_sch_60":"2010-03-08", "lof_act_60":null, "lof_sch_75":"2010-03-23", "lof_act_75":null, "lof_sch_90":"2010-04-07", "lof_act_90":null, "services":"Battery, Driveline", "customer_email":"fxxx@mac.com"}, "Distributor":{"name":"B.C. Distributor #1"}, "Dealer":{"name":"Check UR Emmission - Vancouver"}, "Advisor":{"name":"Brawny Dishtowel"}}
So far so good. My hiddenName configuration is hiddenName: 'data[Repairorder][services]' without an extra "[]" at the end. When I put the "[]" at the end the database values do not get set in the display; the combobox is empty of initial values.
Here is the JSON being sent back to the server after pressing the save button.
With the previous version the first entry was blank, then the two individual entries for the selections. Now, with the latest version, the first entry has the two selected values, followed by the individual selections.Code:data[Repairorder][advisor_id]1 data[Repairorder][customer_email]fxxx@mac.com data[Repairorder][dealer_id]1 data[Repairorder][distributor_id]1 data[Repairorder][lof]Premium data[Repairorder][make]Toyota data[Repairorder][model]4-Runner data[Repairorder][number]RO20100107b data[Repairorder][odometer]13456 data[Repairorder][odometer_type]Miles data[Repairorder][servicedate]2010-01-07 data[Repairorder][services]Battery, Driveline data[Repairorder][services]Battery data[Repairorder][services]Driveline data[Repairorder][vin]5TDZT34A05S250524 data[Repairorder][year]2008
The same end result happens in that the PHP is updating the database with the last entry sent; in this case 'Driveline'.
So the blank entry is gone, both of the selected values are there instead. I am very confident that if that is all I sent back to the server, the one entry that has both of the selected values, both entries would be updated in the database.
Any other suggestions? I can provide the javascript definition for the combobox if desired. This is extremely close. Thank you!
-
15 Jan 2010 5:40 PM #156
@frederickd,
You MUST put the square brackets at the end of the name or hiddenName (if that's what you use) or PHP will not receive all values, it will receive only the last value as a string.
I have MANY working examples where using square brackets at the end of the name/hiddenName post to PHP correctly, so you must have a problem with your PHP code.
It's exactly the same as using regular HTML inputs - PHP MUST have square brackets at the end of the field names to be able to receive an array of data.
What happens when you put saquare brackets at the end, and post some data to your server - do you get an array of values received in PHP?
-
15 Jan 2010 5:48 PM #157
-
15 Jan 2010 7:21 PM #158
That is one of the parts I do not yet know how to do; update the JSON data so that it has [] coming down to match the [] going back up. With one statement on the PHP side the JSON data is being created from the array of DB records found. The JSON data is not being built by hand. I think underneath it is doing a json_encode on the array of DB data being sent.
With the [] on the 'name' and/or 'hiddenName' configuration elements (I've tried both combinations), what is posted back looks like this:
data[Repairorder][services][]
data[Repairorder][services][]Battery
data[Repairorder][services][]Driveline
data[Repairorder][services][]BrakeFlush
Notice the blank entry is back again for me. I am receiving a syntax error on the PHP side which is preventing the save to the DB from occurring. The PHP is receiving an array that looks identical to what is being sent; element 0 blank, elements 1-3 with values.
I will see what I can do to modify my JSON data coming down to have the [] for the one field in question. I'm sure that is why the initial values are not loading automatically.
When the JSON data looks like a string, yet the box is defined as an array, the initial values do not load.
When the JSON data coming down looks like a string, plus the box is defined as a string, the data values load initially for me.
In either case, returning an array, does not work in my case probably because the initial data looked like a string.
It appears one of two things are needed:
1) I figure out how to change my JSON data to be an array, and define the box as an array, so that the returning JSON data is processed as an array in PHP, or
2) I modify the code to accept a string (which it already does) and send back a string, not sending back an array.
That's why I was asking about the feasibility of adding another configuration option of 'returnDataAs' which would default to 'array' but allow a value of 'text'.
No worries. I will figure it out one way or another. Thank you for your patience. Sometimes using frameworks (whether a PHP framework or a javascript framework) saves time, but there are parts that are hidden making debug analysis difficult.Last edited by frederickd; 15 Jan 2010 at 7:59 PM. Reason: Messed up the format of the JSON data
-
16 Jan 2010 12:03 AM #159
-
16 Jan 2010 3:13 PM #160
@abraxxa, then please provide a test case.
Thanks



Reply With Quote