brainbuz / form-diva

Form::Diva Form Elements Generator
3 stars 2 forks source link

Suggestion: no label #6

Closed bbrtj closed 2 years ago

bbrtj commented 2 years ago

Hello, I think it is quite common case to actually have no label at all. Edit inputs can have their labels as placeholders, and checkboxes rarely need them (especially if there's just one in a group). I use a custom solution that does this:

$field->{label} = ''
    if $data->{nl};

And then set nl => 1 in Form::Diva attributes for that field. I think it would be better if I could just label => undef to achieve the same goal (explicit undef, as opposed to value not existing). What I want is no label HTML structure at all for this field - not just empty label.

Currently it causes warnings (undef used in string context), and even passing label => '' doesn't clear the label because it checks whether it is true value (pretty sure value '0' would also be replaced by default value).