Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1545

Submit component should be able to render as button type="submit"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Invalid
    • 5.2
    • None
    • tapestry-core

    Description

      The Submit component renders an <input type="submit">. Since Html 4.0 it is possible to markup the submit button as what it is, a button. The HTML markup is <button type="submit">. I prefer this approach, because it makes styling easier. One could use a general CSS-styling for input-Elements (e.g. common width, special fonts etc.). And the submit button won't be affected.

      To make this change backwards compatible, an optional parameter could be used in org.apache.tapestry5.corelib.components.Submit. The code:

      @Parameter(value="false", defaultPrefix = BindingConstants.LITERAL)
      private boolean renderAsButton;

      And in the method beginRende()r:

      if (renderAsButton) {
      writer.element("button",
      "type", "submit",
      "name", name,
      "id", clientId);
      if (image !=null)

      { writer.element("img", "src", image.toClientURL()); writer.end(); }

      }
      else {
      //... do the usual rentering of input type submit
      }

      Thanks in advance and cheers to the commiters,
      nillehammer

      Attachments

        Activity

          People

            Unassigned Unassigned
            nillehammer nillehammer
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: