bootforms icon indicating copy to clipboard operation
bootforms copied to clipboard

Laravel 4 normalization

Open barbuslex opened this issue 11 years ago • 7 comments

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

barbuslex avatar Jun 04 '14 09:06 barbuslex

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.

adamwathan avatar Jun 06 '14 00:06 adamwathan

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

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

barbuslex avatar Jun 06 '14 07:06 barbuslex

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

Grafikart avatar Sep 12 '14 20:09 Grafikart

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

adamwathan avatar Sep 12 '14 20:09 adamwathan

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.

Grafikart avatar Sep 12 '14 20:09 Grafikart

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

adamwathan avatar Sep 12 '14 20:09 adamwathan

You convinced me ^^

Grafikart avatar Sep 12 '14 20:09 Grafikart