htmlforms

HTML Submit-button: Different value / button-text?


I'd like to create an HTML form submit button with the value 'add tag', however, the web page is in Swedish, so I'd like to have a different button text.

That is, I want to have a button like

enter image description here

but I want to have my code like

if (request.getParameter(cmd).equals("add tag"))
    tags.addTag( /*...*/ );

Is this possible? If so, how?


Solution

  • It's possible using the button element.

    <button name="name" value="value" type="submit">Sök</button>
    

    From the W3C page on button:

    Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content.