HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Search
-
Re: Gdn_Form - Associative Arrays?
I wouldn't say you have to modify the form class. If you look at checkboxes in that class you find the functions Checkbox, CheckboxList, CheckboxGrid, etc. Each function has a different use case. You seem to look for something like a "TexboxList" which doesn't exist. So you would either have to create that for yourself or… -
Gdn_Form - Associative Arrays?
PHP makes it easy to access associative arrays send via HTTP POST. Example: Ask the user to input some poll choices with each choice having a unique ID and a text: <?php if (is_array($_POST['Choice'])) { foreach ($_POST['Choice'] as $ChoiceID => $Choice) { echo "<p>Got {$ChoiceID} => {$Choice['text']}</p>"; }}?><form… -
Re: Gdn_Form - Associative Arrays?
-
Re: Gdn_Form - Associative Arrays?
@Bleistivt: The DiscussionPolls plugin makes use of the special workaround for '[]' provided by Gdn_Form. This workaround does no allow to prepopulate the form fields with values via Gdn_Form::setData(). That is why DiscussionPolls then works around this limitation of that workaround by manually setting the form field's… -
Re: Gdn_Form - Associative Arrays?
@Bleistivt: You will have to search hard for an application that relies on the form <-> table schema correspondence. Nearly every use case requires you to ditch the given Gdn_Form->save() or rather Gdn_Model->save() and overwrite it with custom code. But perhaps I am stuck thinking inside the box. How would you handle… -
Re: Gdn_Form - Associative Arrays?
So the current Gdn_Form fails to handle models with columns like 'abc[]', but it has special code allowing it to handle models with columns like 'abc[x]'... public function escapeString($String) { $Array = false; if (substr($String, -2) == '[]') { $String = substr($String, 0, -2); $Array = true; } $Return =… -
Re: Gdn_Form - Associative Arrays?
I tested Gdn_Form with a table having the following columns: * "x_y", "xy[]", "x[y]", "x.y", "x-dot-y" and "x y". With 'escaping', Gdn_Form fails to handle: * "xy[]", "x-dot-y", "x y" Without 'escaping', Gdn_Form fails to handle: * "xy[]", "x[y]", "x.y", "x y" I therefore propose removing form name escaping… -
Re: Gdn_Form - Associative Arrays?
If it may help you, I already covered this feature in my Aelia Foundation Classes plugin, which is the framework on which almost all my plugins are based. I needed a hierarchy of fields for my Awards plugin, so I extended the form class to handle them (see file class.aeliaform.php). Note The plugin and the class were… -
Re: Gdn_Form - Associative Arrays?
To my understanding, Garden is not a general purpose framework. Features get added when they are needed. I don't see a problem in using the standard PHP toolset when you can't do something through the framework. The convention in garden for deeply nested structures is a flattened representation using the -dot- syntax. See… -
Re: Gdn_Form - Associative Arrays?
Thank you for your code, I might implement your work-around! The whole concept of TextBox / TextBoxList etc. is a bridge abstraction too far. PHP natively handles forms whose values correspond to associative arrays of any depth. Gdn_Form should be an enhancement, not a limitation. Therefore, the only way to clean up this…
10 results