Giter VIP home page Giter VIP logo

easybib_form_decorator's People

Contributors

bgallagher avatar cameronprattedwards avatar fh avatar four43 avatar gusano avatar mischosch avatar rwos avatar till avatar twisty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easybib_form_decorator's Issues

Zend_Form_Element_Checkbox styled like any other elements

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. :(

Use help-block for descriptions

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.

Using with Zend_X - Decorator issue

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!

Custom error messages added to elements don't trigger error class for parent control-group

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:

  1. Performing addError on an element marks the element as invalid, but you would have to call the parent's form isValid() again in order to set the whole form invalid.
  2. In the class EasyBib_Form in function "buildBootstrapErrorDecorators" only the forms getErrors() are handled. But a custom error message added with element->addError() will not be returned by this.

Here is my current workaround:

Step 1

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.

Step2

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

Bug at buildBootstrapErrorDecorators function with subform

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

Order of Buttons for Bootstrap Decorator

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

Hidden catcha field not hidden

If you use Zend_Form_Element_Captcha it adds some additional fields, but for some reason its hidden formfields are shown always.

Support for inline help

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 :)

Bootstrap 3

Does this project plan to support Bootstrap 3?

support for multiple class on radio button

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');
}
}

Multiple errors not properly shown

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.

Select Form Element getOrder() issue

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

cancel and submit

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.

Does'nt work with JQuery 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

Removing label for submit / cancel buttons

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

Label and Element inline

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.