New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Feedback for the new Form system #1312
Comments
You now can add labels that don't wrap around inputs, but you have to ensure IDs are properly assigned yourself. The Label class has been renamed to LabelElement to reflect the naming scheme of the other elements.
I fixed the missing element types and added support for buttons. I also added a addLabel() method. You now can omit the label from the Input-Element and manage labels yourself. It would still desirable to change how labels are generated automatically some day (eg. by autogenerating IDs). |
|
|
|
Maybe something like Edit 2016-04-15: The approach suggest by @splitbrain below solves this:
|
|
I have written a small function that attaches a class and error-messages to form elements based on their name. Not sure if it would be useful/general enough to be integrated into the new class system? public function addErrorsToForm(\dokuwiki\Form\Form &$form, $errorArray) {
for ($position = 0; $position < $form->elementCount(); ++$position) {
if ($form->getElementAt($position) instanceof dokuwiki\Form\TagCloseElement) {
continue;
}
if ($form->getElementAt($position)->attr('name') == '') continue;
$elementName = $form->getElementAt($position)->attr('name');
if (!isset($errorArray[$elementName])) continue;
$form->getElementAt($position)->addClass('error');
$form->addTagOpen('div',$position+1)->addClass('error');
$form->addHTML($errorArray[$elementName],$position+2);
$form->addTagClose('div',$position+3);
}
} |
I just came across a small problem with the form system and thought I'd add it here instead of opening a new issue. In |
@micgro42 Re $pos = -1;
while($pos = $form->findPositionByType('foo', $pos+1) !== false) {
// do something with $pos;
} Is that good enough or would adding a dedicated function still be worth it? |
@micgro42 re the empty attributes. I just checked. Empty attributes are correctly added to the html source as |
@micgro42 regarding the fieldsets. Our old form mechanism did not support nested fieldsets. Opening a new fieldset closed any previous fieldset (similar to what we do in bureaucracy). |
@splitbrain Re: Fieldsets: I am not passionate about the fieldsets, though I do think that nested fieldsets can make sense when one is semantically structuring more complex forms. However if it would be a significant change to the code or the dokuwiki look&feel, then the current version is ok as well. We can always add (pseudo-)fieldsets with addHTML() or addTagOpen and CSS, should we really need them. |
|
It appears that linebreaks in a textarea are |
Textareas use CRLF, but internally we use LF.
fixed it. next time a new ticket would make sense. |
While creating the farmer plugin with the new Form system, this is were I'm collecting my feedback to the new form system. This will most likely be extended over the next couple of days.
Form::addLabel()
method which utilizes thefor
-attribute as opposed to the current approach of placing the input into the label. The current approach is suboptimal because:addClass('class')
is added both to the label and the input fieldForm::addCheckbox
andForm::addRadioButton
actually add TextinputsaddPasswordInput
shows the input as clear text and not as bullets/stars/whateverSubmit
,Reset
, etc.) are completely missing?The text was updated successfully, but these errors were encountered: