adamwathan / bootforms

Rapid form generation with Bootstrap 3 and Laravel.
MIT License
417 stars 103 forks source link

Laravel 4 normalization #16

Open barbuslex opened 10 years ago

barbuslex commented 10 years ago

Hi,

In laravel the names fields are always in first position and the value fields always in second...

To respect the Laravel's conventions it would be preferable to like this :

{{ BootForm::text('first_name', 'First Name') }}

Instead of this :

{{ BootForm::text('First Name', 'first_name') }}

Thanks

adamwathan commented 10 years ago

Yeah I think agree, big breaking change and a bit of a pain to update everything though, haha... Going to think about it for a bit.

barbuslex commented 10 years ago

I make a fork with these changes : https://github.com/barbuslex/bootforms

If you want pull request it for a future release ^^

Grafikart commented 10 years ago

Indeed changing everything would be a pain and a gain ^^

First lots of Framework with Form helpers set name first so it's a bit hard to change this habit to work with bootforms.

Secondly it's not possible to create a textfield without label :( For instance :

BootForm::text($name)->placeholder('My placeholder');

But you are right this is a breaking change that will generate a lot of code change tests + code :(

adamwathan commented 10 years ago

I think I am gonna make the switch for 1.0 to be honest.

For the 'no label' thing, there is actually a hideLabel helper on master now, just not in a tagged release. Should tag soon.

So you can do:

BootForm::text('Name', $name)->placeholder('My placeholder')->hideLabel();

...which keeps your form nice and accessible for screen readers while still hiding the label in the DOM. Probably the better solution than just using a placeholder with no label anyways :)

Grafikart commented 10 years ago

When you start working on this 1.0 comment this issue I could help ^^

Indeed your hideLabel() thing is a good idea but some clients don't care about accessibility and making the label parameter optional (for the 1.0) could be a good shortcut.

adamwathan commented 10 years ago

Sounds good, help would be awesome!

Yeah that's an option, I really think the label should be specified and just hidden though. Doesn't matter if the client doesn't care, it's only a couple of extra keystrokes :)

The other thing is this package is really just meant for rapidly prototyping forms with Bootstrap, and not really meant to fulfill all the custom needs someone might have on something when they are really optimizing the user experience on a form. At that point it's better to just use adamwathan/form and build the Bootstrap markup yourself. Trying to keep this one simple :)

Grafikart commented 10 years ago

You convinced me ^^