button helper

Hi evreybody,

I think it would be relevant to create a new [font="Courier New"]button[/font] helper. Not to generate an [font="Courier New"]input[/font] element, but a [font="Courier New"]button[/font] element.

Actually, if I’m thinking about it, it’s because of the [font=“Courier New”]linkButton[/font] helper which generates a kind of link without any [font=“Courier New”]href[/font] and submits a form thanks to javascript. If you disable javascript, you disable the submission.

With a [font=“Courier New”]button[/font] element with a [font=“Courier New”]type[/font] attribute set to [font=“Courier New”]submit[/font], the submission would still be enabled and we would have an easy element to customize, as well. As I understand the HTML DTD, form controls are inline elements. So they can be anywhere in the document, not necessarily in a form element (it passes html validation). That’s why I think it would be relevant to create a new [font=“Courier New”]button[/font] helper or better to modify the [font=“Courier New”]linkButton[/font] helper.

Let me know what you think about this idea.

Kind regards,

Bruno.

I totally agree with this proposal.

As semantic web suggests, links only should be used when data is received, not modified. To manipulate server resources, it is more acceptable to show control items as buttons.

Don’t forget however, that non-ajax requests can be implemented as simple forms with hidden parameters.

Check CHtml::button()

CHtml::button() will not perform requests without ajax per se. We have to enclose that with hidden fields and form tags.

Well, I’ve already checked it and checked again. I don’t use yii framework for a long time, I still don’t understand everything. So, I’m maybe wrong. But [font=“Courier New”]CHtml::button()[/font] and its cousins generate [font=“Courier New”]<input type=“button|reset|submit|image” />[/font] and not [font=“Courier New”]<button type=“reset|submit|image” />[/font]. Or at least I didn’t succeed to create a [font=“Courier New”]button[/font] element thanks to [font=“Courier New”]CHtml::button()[/font]. If we can, I’m sorry for this proposal.

Good argument. Please create a ticket for this feature. Thanks!