XHTML » input » type="submit"

The type="submit" control creates a rectangular button that can be clicked when the user wants to submit the contents of a form for processing.

A form can be submitted to the same page or to another URL. This is set inside the form tag by using the action attribute. However, if it is important that certain contents of the form be filled out correctly, then you could use the onclick core attribute in the submit button to direct the submission to a JavaScript function that proofs the contents. Alternatively, you could use an onsubmit attribute inside the form tag to direct the submission to the JavaScript function. This is called client-side form verification.

By default the submit button is a gray color and has the text "Submit Query" displayed inside the button. However, you can change the color using style sheets and you can use the value button to provide a different text for the button. The text displayed on the button will determine the minimum size, but you can set a different size using style sheets or the size attribute.

A name is not required, but it is becoming a very common coding practice to give a unique name to every control in a form.

If you assign a value, when the form is submitted, that value will be passed as part of the contents.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>DevGuru XHTML input Tag Example</title>
<input type="submit" name="submit" onclick="submitform()" value="Submit" />
Language(s): HTML