input submit should open in parent window - html

I have a little <form> in HTML, (for logging into something), but the page with the form in in an <iframe> …
When you click the submit button (<input type="submit" value="submit">) , it should open the page where you are logged in in the parent page… How can i do this ?
Maybe possible by using instead of <input> just <a> , if that's possible ?

Related

Form is being submitted by button outside it in the HTML

I have a page with a form and buttons that are separate like so:
<form
method="post"
action="index.php?Page=team_schedule&week_commencing=2018-01-29"
name="apply_filter"
>
// Select box with onchange submit
</form>
<a href="index.php?Page=team_schedule&week_commencing=2018-02-05">
// Button
</a>
When I click the button it takes the entire action value from the form instead. I have tried disabling the JavaScript on the page but it makes no difference.
Why is the wrong parameter being passed when the button is clicked?
Ok I figured it out with the help of the Validity plugin and view source.
I was missing a </form> closing element. The Chrome DOM adds this in retrospectively, but doesn't change the behaviour to match the now closed form. <button> elements have a default type of submit so it was submitting the unclosed form and ignoring the anchor element that was wrapping it.

When to use a button input or a hyperlink styled as a button?

I have a small welcome screen on a website which asks users to either log-in or sign-up. Pretty standard stuff.
The log-in button is within a form so it is a <input type="submit"> element.
However the Sign-up button is not within a form. Its purpose is just to send people to another page where they can register. But I want this this button to look the same as the button that says "log-in" for consistency/aesthetics.
What would be best-practice for the Sign-up link I want to achieve:
Use a <input type="button"> element within a form that takes the user to register
Use a standard hyperlink but style it in CSS so that it looks like a button
If it's semantically a link, but styled as a button, use an <a> element with CSS to make it look like a button.

button tag submitting

i am using this plain html code inside an aspx page. it renders well, but when clicked it submits / reloads the page. i dont want anything to be done on click of this button. whats d issue
<button>
btn1</button>
<button>
btn2</button>
It'll default to type=submit if no type is explicitly given.
You want to put
<button type="button">btn1</button>
Not sure if by pure html you can do so however this way you can black the default submit behaviour:
<button id="a" onclick="return false;">button</button>
Don't use <button>. Use <input> instead:
<input type="button" id="btn1" />
Also, worth noting (from http://www.w3schools.com/tags/tag_button.asp):
If you use the button element in an
HTML form, different browsers will
submit different values. Internet
Explorer will submit the text between
the <button> and </button> tags, while
other browsers will submit the content
of the value attribute. Use the input
element to create buttons in an HTML
form.

HTML form - normal button prevents submitting the form on Enter

I have a form with some
<button>
elements and a normal
<input type="submit">
button to submit the form.
However, when I press Enter when I'm in a textfield, the form does not get submitted but much rather the first Element is "pressed".
How can I change this behavior?
I would recommend changing the <button> tag and turning it into an <input type="button" /> tag. This should force the form to submit the way you want.
You can use javascript to capture that the Enter key was pressed and submit the form.
See this example.
For a complete answer, could you please post your HTML?

Difference between HTML forms submit tags

as far as I know there are three methods to submit an HTML form without JS or keyboard:
1. input type=submit
2. button tag
3. input type=image
Is there another way to create an element submitting the form on being pressed?
Is it correct to handle button tag (type=submit) same as input type=submit (I mean, if we discard the fact button can contain inner html, we can simply replace button with input type="submit" and the form will be sent correctly)?
Is adding name.x and name.y the only difference when using input type=image?
Not that I know of, those should be the only pure html ways to submit the form other than directly invoking the submit method which is internal Javascript, but that is what the submit button does anyway.
The button element has issues in Internet Explorer regarding which
value it passes, I do not recommend
the use of it.
Yes, they're pretty much the same
As far as I know input type=image is exactly the same except that it
sends those extra coordinate
parameters which you can ignore on the
server-side.
With JavaScript, you can call the form's submit method. However, this should be avoided as it will not work if the user has JavaScript disabled.
No, because a button tag can be given a value separate from the text displayed on the button, not to mention the <button> tag's ability to inline HTML. (For example <button type="submit"><img src="submit.png" alt="Submit"></button>).
Yes, the main feature of <input type="image"> is the addition of the x and y coordinates.
You can use JavaScript to simulate it. I'd take an <input type="submit"> and replace it with the element that you'd like to submit a form with, so it's still accessible for users without JavaScript.
<input type="submit" id="submit-button" value="submit" />
Then in JavaScript (using jQuery in this example):
$('#submit-button').remove().after('Submit form');
$('#submit-link').click( function(event){
event.preventDefault();
$('#submit-link').closest('form').submit();
});