Task #9214
Task #26664: Clean up Form ViewHelpers
Task #26658: Make Form ViewHelpers consistent
Improve handling of bound properties in checkbox, radio and select ViewHelpers
Status: | Closed | Start date: | 2010-08-09 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 0% |
|
Category: | ViewHelpers | |||
Target version: | - | |||
Has patch: | No |
Description
Currently the behavior for form.checkbox, form.radio & form.select ViewHelpers is not clear and leads to errors when bound to objects. See #8854 for example.
We'll have to define, what output is expected in which case to be able to properly refactor these ViewHelpers.
Related issues
History
#1 Updated by Bastian Waidelich almost 5 years ago
- File given_v1.png added
- File form.checkbox_v1.png added
- File form.radio_v1.png added
Attached is a first version of an input-output-matrix for checkbox and radio ViewHelpers. A sheet for select ViewHelper follows.
Feel free to comment
#2 Updated by Bastian Waidelich almost 5 years ago
- File given_v2.png added
- File form.checkbox_v2.png added
- File form.radio_v2.png added
Added examples for properties of type string/integer after discussion with Michael Feinbier.
#3 Updated by Bastian Waidelich almost 5 years ago
- File deleted (
given_v1.png)
#4 Updated by Bastian Waidelich almost 5 years ago
- File deleted (
form.checkbox_v1.png)
#5 Updated by Bastian Waidelich almost 5 years ago
- File deleted (
form.radio_v1.png)
#6 Updated by Bastian Waidelich almost 5 years ago
- File deleted (
given_v2.png)
#7 Updated by Bastian Waidelich almost 5 years ago
- File deleted (
form.checkbox_v2.png)
#8 Updated by Bastian Waidelich almost 5 years ago
- File deleted (
form.radio_v2.png)
#9 Updated by Bastian Waidelich almost 5 years ago
- File given_v3.png added
- File form.checkbox_v3.png added
- File form.radio_v3.png added
- File form.select_v3.png added
- File 9214_improve_checkbox_radio_and_select_viewhelpers.xlsx added
Updated version of the input-output matrices and the corresponding Excel file
#10 Updated by Michael Feinbier almost 5 years ago
Hey
thanks for your work on this :)
I think you missed the value-attribute in the form.select matrix. The combination of both value and option is important for the behaviour of this viewHelper.
I updated your Excel-sheet in the select-tab. I did the matrix for "tags" and "hidden" already. If I find some additional time today I will do the rest oft it.
#11 Updated by Peter Niederlag over 4 years ago
any updates on this? can we help out somehow?
#12 Updated by Michael Feinbier over 4 years ago
Hey Peter,
I started to work on this some days ago. Would be nice if you have a look at the matrix and see, if you miss something
#13 Updated by Bastian Waidelich over 4 years ago
- Priority changed from Should have to Must have
Michael Feinbier wrote:
I started to work on this some days ago.
That's great. This seems to be one of the burning issues!
#14 Updated by Sebastian Kurfuerst about 4 years ago
- Target version set to 1.0 beta 2
- Parent task set to #26658
#15 Updated by Christopher Seidel about 4 years ago
Hi,
i hope this is okay for you but i had problems with the checkbox Viewhelper and ObjectStorages. I wasnt able to bind an ObjectStorage to a checkbox but i made a small solution to fix this problem.
Old code:
} elseif (is_array($propertyValue)) { $checked = in_array($valueAttribute, $propertyValue); $nameAttribute .= '[]'; } else { throw new Tx_Fluid_Core_ViewHelper_Exception('Checkbox viewhelpers can only be bound to properties of type boolean or array. Property "' . $this->arguments['property'] . '" is of type "' . (is_object($propertyValue) ? get_class($propertyValue) : gettype($propertyValue)) . '".' , 1248261038); }
New Code with added the elseif
} elseif (is_array($propertyValue)) { $checked = in_array($valueAttribute, $propertyValue); $nameAttribute .= '[]'; } elseif(is_object($propertyValue)) { foreach ($propertyValue as $value) { if($valueAttribute == $value->getUid()) { $checked = $value->getUid(); } } $nameAttribute .= '[]'; } else { throw new Tx_Fluid_Core_ViewHelper_Exception('Checkbox viewhelpers can only be bound to properties of type boolean or array. Property "' . $this->arguments['property'] . '" is of type "' . (is_object($propertyValue) ? get_class($propertyValue) : gettype($propertyValue)) . '".' , 1248261038); }
#16 Updated by Robert Lemke almost 4 years ago
- Target version changed from 1.0 beta 2 to 1.0.0
#17 Updated by Karsten Dambekalns almost 4 years ago
- Target version deleted (
1.0.0)
#18 Updated by Bastian Waidelich about 3 years ago
- Status changed from Accepted to Closed
- Has patch set to No
Most of this has been resolved in the meantime and the Form framework shows that the Form ViewHelpers work in fact. There are still some glitches, but we should tackle them in smaller change sets.