easybib / easybib_form_decorator Goto Github PK
View Code? Open in Web Editor NEWTwitter bootstrap decorators for Zend_Form
License: Other
Twitter bootstrap decorators for Zend_Form
License: Other
When using with form decorator with Zend_Form_Element_Checkbox
$this->chkbox = new Zend_Form_Element_Checkbox('chkbox');
$this->chkbox->setLabel('Check me!');
....
\EasyBib_Form_Decorator::setFormDecorator(
$this, \EasyBib_Form_Decorator::BOOTSTRAP, 'submit'
);
I get following code:
<div class="control-group"><label class="control-label optional" for="chkbox">Check me!</label>
<div class="controls">
<input type="hidden" value="0" name="chkbox"><input type="checkbox" value="1" id="chkbox" name="chkbox"></div></div>
Checkbox is rendered below label, not on the left of label like in Twitter Bootstrap.
I also have some weird issues with SubForms, but I can't reproduce it right now. :(
Its probably better to use help-block instead of help-inline, so the description is under the field (like on the Bootstrap demo page) and not next to the input element.
Would be great if this can be added as it would simplify making these types of forms.
Hello,
how to properly declare UiWidgetDecorator in Decorator.php, currently I'm geting this message when using \ZendX_JQuery_Form_Element_DatePicker
I can not declare decorator in my form, cause I see that you disable all decorators and put yours.
Warning: Exception caught by form: Cannot render jQuery form element without at least one decorator implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker' interface. Default decorator for this marker interface is the 'ZendX_JQuery_Form_Decorator_UiWidgetElement'. Hint: The ViewHelper decorator does not render jQuery elements correctly.
Thanks in advice!
Seems, that current EasyBib_Form_Decorator is incompatible with twitter bootstrap 2.0. Can you confirm?
Regards
Hello,
in a controller script I use the follwoing code to add an error message to a form's element:
$formName->getElement('elementName')->addError('Error message');
The error message is shown next to the element, but the whole div.control-group does not have class "error" added to it.
Es far as I can see this is for the following reasons:
Here is my current workaround:
After I call $formName->getElement('elementName')->addError('Error message')
, I call $form->buildBootstrapErrorDecorators();
This funtion is otherwise only called in EasyBib_Form's function "isValid", which calls "isValid()" of the parent class. But that seems to reset all error messages (as far as I can see), and only validates against the validators. The form would be valid again and "buildBootstrapErrorDecorators()" would not be performed.
In "buildBootstrapErrorDecorators" I add:
foreach ($this->getElements() AS $element)
if (count($element->getErrorMessages()) > 0) {
$htmlTagDecorator = $element->getDecorator('HtmlTag');
if (empty($htmlTagDecorator)) {
continue;
}
$class = $htmlTagDecorator->getOption('class');
$htmlTagDecorator->setOption('class', $class . ' error');
}
I hope it is quite understandable what my problem is, and hopefully my (or a better) solution for this will be implemented. If I just missed something and am totally wrong, and if what I want could be achieved otherwise, I apologize and kinldy ask for a hint into the right direction.
Best regards
Christian
EasyBib should support class="well"-forms ("using just form controls, no extra markup").
When i have a form and add a subform with required elements, the method buildBootstrapErrorDecorators try to get subform with getElement call and getDecorator Htmltag.
89: $htmlTagDecorator = $this->getElement($key)->getDecorator('HtmlTag');
at class Form.php
Thanks for the great work
I would like to change the order of the buttons for the Bootstrap decorator, but I get an issue when I place a Submit button as the last item in the form, so I always have to put a cancel button last
I am wondering whether this is a Zend_Form or EasyBib issue.
Thanks
A couple of the examples on the Twitter Bootstrap page (http://twitter.github.com/bootstrap/#forms) include prepended text to text fields. Would be great to have a simple mechanism for adding this through EasyBib_Form_Decorator
If you use Zend_Form_Element_Captcha
it adds some additional fields, but for some reason its hidden formfields are shown always.
The twitter bootstrap documentation said :
To add help text for your form inputs, include inline help text with or a help text block with
after the input element.
That could be cool to add support for this feature.
ps : sorry for my english :)
Does this project plan to support Bootstrap 3?
Currently it is not possible to build an inline radio button form becase the decorator always set the label_class attribute to radio.
here is a suggestion to allow to add custom classes to radio button label
if ($e->getType() == 'Zend_Form_Element_Radio') {
$e->setDecorators(self::$_MultiDecorator[$format]);
$e->setSeparator('');
if ($e->getAttrib('label_class') != null) {
$previousClass = $e->getAttrib('label_class');
$e->setAttrib('label_class', $previousClass . ' radio');
} else {
$e->setAttrib('label_class', 'radio');
}
}
If a form element has multiple errors, they are not properly grouped together.
<span class="help-inline">'invalid' is no valid email address in the basic format local-part@hostname</span>There is no account with this email address.</li></ul></div></div>
There are no opening li/uls and for some reason the first message is ended with a closingtag for span and not opened with ul/li.
This looks pretty messy now.
Hello all,
I've been playing with EasyBib_Form_Decorator for a little while now and I can't seem to get select elements to work correctly. I have:
<?php
class Default_Form_Test extends EasyBib_Form
{
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'test-form');
$model = new Zend_Form_Element_Select('model');
$model->setMultiOptions(array(0 => 'Hello', 1 => 'World', 2 => '!'));
$this->addElements(array(
$model
));
// set decorators
EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP);
}
}
And I keep getting the error:
Fatal error: Call to a member function getOrder() on a non-object in [path to library]/Zend/Form.php on line 3322
Has anyone else run into this issue? Am I missing something?
Thanks,
-Seth
These seem to be reserved and btn
classes get applied automatically by the decorator. Maybe we should double-check that e.g. a form element named "cancel" is indeed a submit or button before we apply the class.
The inline help (setDescription
) text turns red if there are errors attached to the element.
Hi, I try to use ZendX_JQuery_Form_Element in my form but obviously when I set decorator with this line :
EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP,);
the decorator for JQuery element are disable and my form doesn't work :/
Error : Warning: Exception caught by form: Cannot render jQuery form element without at least one decorator implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker'
How to fix it?
Regards,
Pierre
Hi guys,
A great resource this, thanks again for publishing it.
I'm having trouble removing the label element from submit buttons.
I'm using $submit->removeDecorator('Label'); to no avail, it seems the decorator might supersede this?
Thanks
Hi I am quite new to Twitter Bootstrap and I would like to know if there is a way to have a label and say a checkbox inline.
This would require being able to add a class to the div "control-group" and/or "controls", Bu t I cannot seem to find how to do it!
Does this feature already exist ? How can it be done ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.