|
w. studer - 2013-02-12 15:43:07 - In reply to message 10 from Sebastian Schlapkohl
Woah, again ...
Thanks a lot.
Just complete something, then I will give it a try.
Sebastian Schlapkohl - 2013-02-12 15:55:54 - In reply to message 11 from w. studer
Should be complete now.
w. studer - 2013-02-12 19:13:30 - In reply to message 12 from Sebastian Schlapkohl
Tested with SELECT and works fine.
Thanks a lot again.
Just one point, where some people may get confused:
In case the options key is a numeric value, then I can not use for disabled array/value the numeric option key, because it is interpreted as index.
For me it was easy to find the workaround here.
Sebastian Schlapkohl - 2013-02-12 19:31:30 - In reply to message 13 from w. studer
There should be a clear distinction between ints, which are indices, and int-strings, which are values. This seemed to work in my test cases, but I will look into that again.
Sebastian Schlapkohl - 2013-02-12 20:29:59 - In reply to message 13 from w. studer
Hm, can't find anything wrong with setting of numerical values. I built expanded test cases and everything behaves as it should.
I changed the "testselectsingle" and the "testselectmultiple" explicitly to cover muddled indices and numerical values as single values as well as mixed array, but everything's all right so far.
You can have a look at it here:
sschlapkohl.1337server.com/htmlform ...
On the left you can view the current code base and in the right column you can execute exactly that code and see the testcases in action, based on the current version.
If this doesn't clear up the problem, please send me some source to look at, cause this would be unpleasant to put it mildly.
w. studer - 2013-02-13 09:22:03 - In reply to message 15 from Sebastian Schlapkohl
Hi
I think I found the difference in means.
Example:
I have a table which contains records, having a numeric key field.
The records from this table I add into the options array, having the numeric key as array key:
>>$option[$mytable_fetch['key']] = $mytable_fetch['data'];
With data it looks like:
>>$option[5] = 'Hugo';
In case I use now same key for the disabling, I used:
>>$disabled[] = $mytable_fetch['key'];
With data it looks like:
>>$disabled[] = 5;
What I should do is:
>>$option["'" . $mytable_fetch['key'] . "'"] = $mytable_fetch['data'];
>>$disabled[] = "'" . $mytable_fetch['key'] . "'";
With data it looks like:
>>$option['5'] = 'Hugo';
>>$disabled[] = '5';
For me, a numeric key is a numeric value in the key field.
You differentiate between a numeric value as an Index and a numeric value in a string as a key.
Fine for me.
Thanks a lot
Sebastian Schlapkohl - 2013-02-13 10:22:00 - In reply to message 16 from w. studer
Ah, now I see what's the problem, keys as well as the values for options are indeed always strings, you won't get anything different back from the Request anyway, so setting anything different here is useless. If I'm not misstaken I'm even casting keys and values to String for this.
BTW:casting something to String is much easier done like "$var" or ''.$var :)
w. studer - 2013-02-13 10:53:16 - In reply to message 17 from Sebastian Schlapkohl
Oh, good to know.
Still a lot to learn of PHP ... ;-)
|