Why the submit button doesn't show the text? - html

Why the submit button doesn't show the text?
It shows:
The tag for it: <input type=submit name="OK" value=""/>
Thought <input type=submit name=OK value=""/> would help,but not.

The value attribute will be shown in the button.
<input type=submit name=OK value="button"/>

Try this:
<input type="submit" name="OK" value="Submit Label"/>
See:
https://www.w3schools.com/tags/att_input_type.asp

You have to define into value="" the text to display.
Example :
<input type=submit name="OK" value="OK" />

Related

HTML Form to email issue. What is wrong with the line of code?

<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
Should I change "saveForm" to "Post"? Then where do I insert email address to send to?
yes you can do this with proper form
<form action="your page where you send the value"> <label>Name:
</label> <input type="text" name="name"> <label>Email:</label> <input
type="email" name="name"> <input type="submit" name="submit"> </form>
I cannot add the html form script here as this block does not allow me to. Can you view source at page at link: http://www.sparesite.co.za/index.html

Html 5 required on radio button wil not reset

Why won't an html5 required on radio button group reset with form reset button if it was selected. for example you have a radio button group in a form with the html5 required set if you select one of the radio buttons then click the reset form button it doesn't reset the radio button group required validation so even though the form was reset. So basically you click submit button without selecting anything the radio buttons are given an outline in red then you select one and click reset you are then able to submit the form without selecting a radio button? any help on why it does this would be greatly appreciated. I may misunderstand how its supposed to work.
Simple test
<html>
<form>
<input type="radio" name="test" required>
<input type="radio" name="test" required>
<input type="submit" value="submit">
<input type="reset" value="cancel">
</form>
</html>
It is because you are using same name for the radio buttons.If you give the same name only one radio button of the can be checked.And so it passes the Validation
Example : Different name for radio buttons.
<form>
<input type="radio" name="test" required>
<input type="radio" name="test2" required>
<input type="submit" value="submit">
<input type="reset" value="cancel">
</form>
Example : Same name for radio buttons.
<form>
<input type="radio" name="test" required>
<input type="radio" name="test" required>
<input type="submit" value="submit">
<input type="reset" value="cancel">
</form>
You need to give them different value attributes (but the same name so it's clear that those are two different options for the same "question" and only one of them should be selectable):
<html>
<form>
<input type="radio" name="test" value="1" required>1
<input type="radio" name="test" value="2" required>2<br>
<input type="submit" value="submit">
<input type="reset" value="cancel">
</form>
</html>

How to reset ONLY a single input tag in a formfield with just html5

i tried the following example and my aim is to achieve that if i press the reset button, only the field in the current line will be reseted, is this possible with only html5 and no jquery/ javascript ? any ideas are welcome :)
<form action="fieldset_legend.htm">
<fieldset>
<legend>Absender</legend>
<label for="vor">Ihr Vorname:</label>
<input id="vor" size="40" maxlength="40" name="Vorname" type="text">
<input type="reset" for="vor" value="reset">
<label for="nach">Ihr Zuname:</label>
<input id="nach" size="40" maxlength="40" name="Zuname" type="text">
<input type="reset" for="nach" value="reset">
</fieldset>
</form>
Use javascript...
function resetInput(id) {
document.getElementById(id+"input").value="";
}
HTML:
<label for="vor">Ihr Vorname:</label>
<input id="vorInput" size="40" maxlength="40" name="Vorname" type="text">
<input type="button" id="vor" onclick="resetInput(this.id) "value="reset">
<label for="nach">Ihr Zuname:</label>
<input id="nachInput" size="40" maxlength="40" name="Zuname" type="text">
<input type="button" id="nach" onclick="resetInput(this.id) value="reset">
I don't believe there is a way to avoid JavaScript in this case as the input 'reset' will reset for all the elements in the form.
reset: A button that resets the contents of the form to default
values.
Input elements

Form action pass correct text values according to submit button clicked

My code is
<form method="post">
<input type="text" name="t1" id="t1">
<input type="text" name="t2" id="t2">
<input type="submit" name="s1" id="s1" value="Submit1" onclick='this.form.action="p1.php";'>
<input type="submit" name="s2" id="s2" value="Submit2" onclick='this.form.action="p2.php";'>
</form>
Now I want, if I click on submit1 p1.php should open and I can only access value of text1 and not text2.
Similarly, if I click on submit2 p2.php should open and I can only access value of text2 and not text1.
The pages are openning but I can access both the values ie t1 and t2
I only want to do it with html no js and jquery and I need to make only one form.
NO separate forms allowed.
You can use the attribute formaction on the submit button to change the current action of your form, without using JS. See formaction spec. In case you need to support older browsers like IE9- you can simply use webshim to polyfill it:
<script>
if(!('formAction' in document.createElement('input')){
webshim.polyfill('forms');
}
</script>
<form method="post">
<input type="text" name="t1" id="t1">
<input type="text" name="t2" id="t2">
<input type="submit" name="s1" id="s1" value="Submit1" formaction="p2.php">
<input type="submit" name="s2" id="s2" value="Submit2" formaction="p2.php">
</form>
hy sam,
Your question look like wrong may be you are asking to submit all form values in different action using two submit button in a single form.
may be this code will help you to submit values in different form action
<form method="post">
<input type="text" name="t1" id="t1">
<input type="text" name="t2" id="t2">
<input type="submit" name="s1" id="s1" value="Submit1" formaction="p1.php">
<input type="submit" name="s2" id="s2" value="Submit2" formaction="p2.php">
</form>
If you do not want to use javascript, the only solution that I can think of is to use two HTML forms.
<form method="post">
<input type="text" name="t1" id="t1">
<input type="submit" name="s1" id="s1" value="Submit1" onclick='this.form.action="p1.php";'>
</form>
<form method="post">
<input type="text" name="t2" id="t2">
<input type="submit" name="s2" id="s2" value="Submit2" onclick='this.form.action="p2.php";'>
</form>

Change form submit from image to text link

I have a search form that has a image as the button which is great, but i can't get the image to look the same as other text, i would like to remove this image and just use it as text instead then style it accordingly, if someone could give me some advice on doing this the simplest way possible that would be appreciated.
<form action=".php" method="get" onsubmit="return check_small_search_form()">
<label for="search_query"></label>
<input type="text" name="search_query" id="search_query" class="Textbox" value="Search" autocomplete="off">
<input type="image" src="Search.gif" class="Button">
</form>
Many thanks.
You can replace the image with a submit button and remove the borders and background with css. That should show just plain text
<form action=".php" method="get" onsubmit="return check_small_search_form()">
<label for="search_query"></label>
<input type="text" name="search_query" id="search_query" class="Textbox" value="Search" autocomplete="off" />
<input type="submit" value="The text you want" class="Button" />
</form>