Giter VIP home page Giter VIP logo

laravel4-form-builder's Introduction

Hi there ๐Ÿ‘‹

Kristijan's github stats

Top Langs

laravel4-form-builder's People

Contributors

kristijanhusak avatar

Stargazers

 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

laravel4-form-builder's Issues

Removing field from form object, then setting as child of another form, adds field back

Essential form:

$child = Form::create(...);
$child->remove('removed_field');

$parent = Form::create(...);
$parent->add('child', 'form', [ 'class' => $child ]);

form($parent); // yields a form containing removed_field 

Looks like ChildFormType::createChildren() line 27 in the rebuildForm() call is adding the fields back based on the original form specification. The docs do seem to be "class" oriented, but as objects are accepted, I'm expecting the object state to remain.

uploads files with formbuilder laravel collection

Hello everyone, I'm trying to put a multiple file upload system on laravel using the collections on FormBuilder, the added part works without problem but it's on the editing part that me block, I want that when editing files in each input also display, how to do? thank you very much.
Here is my exemple of add files
capture

Repeated fields' name in child form different than non-repeated

Essential example:

class MyForm extends Form {
    public function buildForm() {
        $this->add('foo', 'text');
        $this->add('bar', 'repeated', [ 'type' => 'text', 'first_name' => 'bar', 'second_name' => 'bar_confirm' ]);
   }
}

$child = new MyForm();

$parent = Form::create(...);
$parent->add('child', 'form', [ 'class' => $child ]);

The essential rendered output is:

<input class="form-control" id="foo" name="parent[foo]" type="text">    
<input class="form-control" id="bar" name="bar" type="text">    
<input class="form-control" id="bar_confirm" name="bar_confirm" type="text">    

Expecting all inputs to be named in "parent" space, ie: parent[bar] and parent[bar_confirm].

prototype name in nested forms

Is possible to inherit parents prototype name into childrens prototype in multiple nested form collections?
If I have users with multiple addresses, and address can have multiple cars. Car form prototype looks like this:

<div class="form-group"  >
  <label for="addresses[0][cars][__NAME__][brand]" class="control-label" for="timezone">Brand</label>
  <input class="form-control" name="addresses[0][cars][__NAME__][brand]" type="text" id="addresses[0][cars][__NAME__][brand]">
</div>  

This would be better this way:

<div class="form-group"  >
  <label for="addresses[__ADDRESS_NAME__][cars][__CAR_NAME__][brand]" class="control-label" for="timezone">Brand</label>
  <input class="form-control" name="addresses[__ADDRESS_NAME__][cars][__CAR_NAME__][brand]" type="text" id="addresses[__ADDRESS_NAME__][cars][__CAR_NAME__][brand]">
</div>  

Custom fields not working in nested types

I have some custom fields and everything is fine when these fields are in level 1 hierarchy.
But if I put custom fields to a nested form (for example in a 'form' type) it renders as text.

Show all errors, not just first.

I've noticed that the error messages in templates call ->first(), but I think a more generic approach using ->all() would support broader use. For example:

@if ($errors->has())
   <div class='errors'>
   @foreach ($errors->all() as $error)
      <div class='error'>{{ $error }}</div>
   @endforeach
  </div>
@endif

Consider password validation. When a password fails to satisfy policy, there may be multiple messages, like "Password must contain at least one number" and "Password must contain at least one letter". All of these should be shown.

This can be solved by imploding all messages into the first. (What I'm doing now, actually.) Alternatively, this could be handled with custom templates. Both of these feel like hacks, though.

Display errors for collections

When you using collections in your form and you got error for a collection element, errors bag looks like this:

object(Illuminate\Support\ViewErrorBag)[125]
  protected 'bags' => 
    array (size=1)
      'default' => 
        object(Illuminate\Support\MessageBag)[126]
          protected 'messages' => 
            array (size=1)
              'maximum' => 
                array (size=1)
                  0 => string 'The maximum must be a number.' (length=29)
          protected 'format' => string ':message' (length=8)

In this example there is a recipient collection which has minimum and maximum fields. Now I typed string into the second collection elements maximum field, but the error 'Max must be a number' will show for every maximum fields in this collection.

access prototype from view?

I would like to add prototype-s to a data attribute in all collection view.
Is this possible to access prototype string in views/collection.php?

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.