You can clone with
HTTPS or Subversion.
When using the form generation with Fieldset::add(), it seems impossible to obtain a field.
type = submit generates <input type="submit">
type = button generates <button type=button">
Since the "type" attribute is used to determine which tag to use when displaying the field, we cannot display a
I'm in favor of changing the default behaviour on this and generateing a
This works ok in the Form class:
$form->submit() // generates <input type="submit"...
$form->reset() // generates <input type="reset"...
$form->button() // generates <button ...
The problem is in the Fieldset build() method, that indeed uses the 'type' attribute to determine which HTML tag needs to be generated.
I'm not really in favour of inventing new "fake" type's to work around it, I'd rather find a solution to allow you to define the tag. Maybe introduce a 'tag' attribute, and fall back to type detection if it is not present? I have to think about this...
Yeah, the tag attribute seems fine to me.
@jschreuder Any preference on how to solve this?
@WanWizard I like your 'tag' property proposal, that keeps current behavior intact and allows for the flexibility this issue requires to be solved. My only "but" is that it won't really choose the tag, but instead choose which Form class method is used. But I can't think of a better solution.
So if I implement this, I need to leave current "type" fully backwards-compatible.
And juste add the case type = submit & tag = button ?
type = submit
tag = button
I think in Form_Instance line 224 use $attributes['tag'] instead of 'input' when it exists and unset it is ok?
return html_tag('input', $this->attr_to_string($attributes));
$tag = $attributes['tag'];
$tag = 'input';
return html_tag($tag, $this->attr_to_string($attributes));
added the ability to specify the html tag used to create form input. …
I'm just seeing this now. Thank you!
It needs a little tweak in the build() method from Fieldset_Field too. I'm taking care of that now.