Why is my HTML code showing in my forms text area? - html

I'm trying to create a two column form in HTML using the below code.
<div id="form-wrapper">
<form class="contact_form" action="" method="post" name="contact_form">
<ul>
<div id="form_left">
<li>
<span class="required_field"> * Denotes a required field</span>
</li>
<li>
<label for="name">Name:</label>
<input type="text" name="name" placeholder="John Doe">
</li>
<li>
<label for="telephone">Contact Number:</label>
<input type="tel" name="telephone" placeholder="(01225) 123456">
</li>
<li>
<label for="email">Email:</label>
<input type="email" name="email address" placeholder="example#example.com">
</li>
</div>
<div id="form_right">
<li>
<label for="message">Message:</label>
<textarea name="message" cols="40" rows="6" >
</li>
</div>
</ul>
</form>
</div>
(http://jsfiddle.net/qrttZ/)
But for some reason, it is showing the bottom half of my HTML code inside of the text area window.
I can't see any open tags so i'n not sure why this is.

The fact that HTML doesn't need the XHTML self closing short tags, e.g. <input /> means it's very easy for rookies to make this mistake as textarea performs a very similar purpose. It's just that for a very good reason it needs closing.
<textarea name="message" cols="40" rows="6" ></textarea>
...
That done, this
<ul>
<div id="form_left">
<li>
is bad. <li> show follow <ul> there should not be a <div> there.
Also
<label for="name">Name:</label>
<input type="text" name="name" placeholder="John Doe">
Without an id in the input, that for is useless.
<label for="name">Name:</label>
<input type="text" name="name" id="name" placeholder="John Doe">
But if you're going to use a label with no markup between it and the input and if you're not styling it
<label>Name: <input type="text" name="name" placeholder="John Doe"></label>
is less to output

Related

How do I make the border radius rounded for the form element?

I have been throwing in border-radius: 10px in my CSS into the form-section class, the fieldset, the form. I can't figure out why my border-radius isn't working. The form still has a sharp edge to it. Suggestions?
<section class="form-section">
<form action="formdumpURL" method="POST">
<fieldset>
<h2>Get In Touch</h2>
<p>Take this first step to transforming your relationship with your dog.
<br>Contact us to find out more about our services.</p>
<ul id="form-input">
<!--fname-->
<li><label for="fname"><b>Name</b></label>
<input type="text" id="fname" name="firstname" class="text-input"></li>
<!--email-->
<li><label for="email"><b>E-mail</b></label>
<input type="text" id="email" name="email" class="text-input" required></li>
<!--phone-->
<li><label for="phone"><b>Mobile</b></label>
<input type="tel" id="phone" name="phone" pattern="[0-9]{3}-[0-9]{7}" required></li>
<!--button-->
<li class="button">
<button type="submit">Fetch!</button>
</li>
</ul>
</fieldset>
</form>
</section>
The below works in isolation, but I'm not sure what other css you are battling with.
If this doesn't work, there may be a specificity issue with other css rules overriding this rule
.form-section fieldset {
border-radius:10px;
}
<section class="form-section">
<form action="formdumpURL" method="POST">
<fieldset>
<h2>Get In Touch</h2>
<p>Take this first step to transforming your relationship with your dog.
<br>Contact us to find out more about our services.</p>
<ul id="form-input">
<!--fname-->
<li><label for="fname"><b>Name</b></label>
<input type="text" id="fname" name="firstname" class="text-input"></li>
<!--email-->
<li><label for="email"><b>E-mail</b></label>
<input type="text" id="email" name="email" class="text-input" required></li>
<!--phone-->
<li><label for="phone"><b>Mobile</b></label>
<input type="tel" id="phone" name="phone" pattern="[0-9]{3}-[0-9]{7}" required></li>
<!--button-->
<li class="button">
<button type="submit">Fetch!</button>
</li>
</ul>
</fieldset>
</form>
</section>

Why is my HTML Element and Form not being recognized by the browser?

This may seem like I'm missing something super simple, but I cannot for the sake of me figure this out.
I have a <form> wrapped inside a <div class="form">, and for some reason, in the browser, the form, and the div, have a height of 0, and all the content is overflow. When I inspect the document from the browser, the browser does not recognize this div or form.
Here's the problem area here:
Also, you can inspect it at this website here: Web page
<div class="form">
<form>
<div class="contact">
<label for="first">First Name:</label>
<input id="first" type="text" placeholder="First Name"><br>
<label for="last">Last Name:</label>
<input id="last" type="text" placeholder="Last Name"><br>
<label for="tel">Phone Number:</label>
<input id="tel" type="tel" placeholder="(###) ###-####"><br>
<label for="email">Email:</label>
<input id="email" type="email">
</div>
<div class="address">
<label for="address-1">Address</label>
<input id="address-1" type="text" placeholder="Address Line 1"><br>
<label for="address-2">Address, Line 2</label>
<input id="address-2" type="text" placeholder="Address Line 2"><br>
<label for="city">City:</label>
<input id="city" type="text" placeholder="City"><br>
<label for="state">State:</label>
<select id="state">
<optgroup>
</optgroup>
</select></br>
<label for="zip">Zip Code:</label>
<input id="zip" type="text" placeholder="01234">
</div>
</form>
</div>
Does you talk about that the div and form have height:0 and the content overflow?
If so, it is because the content divs have float css attributes. to fi it, you have to add at the end of the contents div with style clear:both
<div class="form">
<form>
<div class="contact">
...
</div>
<div class="address">
...
</div>
<div style="clear:both"></div>
</form>
</div>

IE10 - hover triggers unwanted :hover event

In the jsfiddle included below, there are two hover forms in the footer. When you hover over "login", the login form appears as expected. However, hover over the username input box, and the registration form appears. Also, hover over "register" in the footer, and the registration form appears as expected. However, move the mouse over the "Username" label, and the login form displays.
I'm only getting this error in Internet Explorer (I'm using version 10). Chrome and FireFox have been tested. When I go into compatibility view in IE, I no longer have this problem.
http://jsfiddle.net/LcPqR/4/
<body>
<div id="header">
</div>
<div id="middle">
<div id="content">
</div><!--/content-->
</div><!--/middle-->
<div id="footer">
<ul id="footer_row">
<li>login
<ul>
<li ><form name="loginForm" action="redirect.php" method="post">
<label for="inputUser">Username</label> <input id="inputUser" type="text" name="user" maxlength="30" />
<label for="inputPass">Password</label> <input id="inputPass" type="password" name="pass" maxlength="254" />
<input type="checkbox" name="remember" value="yes"> <label for="chkRemember" />Stay signed in</label>
<input type="submit" class="submit-form" value="Submit" />
</form>
</li>
</ul>
</li>
<li>register
<ul>
<li ><form name="registerForm" action="register.php" method="post">
<label for="inputUser" >Username</label> <input id="inputUser" type="text" name="user" maxlength="30" />
<label for="inputEmail" >E-Mail Address</label> <input id="inputEmail" type="text" name="email" maxlength="254" />
<label for="inputPass1" >Password</label> <input id="inputPass1" type="password" name="pass1" maxlength="254" />
<label for="inputPass2" >Password (again)</label> <input id="inputPass2" type="password" name="pass2" maxlength="254" />
<input class="submit-form" type="submit" value="Submit" />
</form>
</li>
</ul>
</li></ul>
</div>
</body>

Won't submit login details

I'm trying to get our login portal working, but for some reason it won't accept the login details. It just won't submit the information, it just refreshes the page.
Any ideas would be extremely appreciated on how to fix this.
Many thanks!
<div id="nav">
<ul>
<li id="login">
<a id="login-trigger" href="#">
Log In <span>▼</span>
</a>
<div id="login-content">
<form>
<form action="https://na6.salesforce.com/secur/login_portal.jsp" method="POST">
<input type="hidden" value="00D80000000anEa" name="orgId">
<input type="hidden" value="060800000006ANB" name="portalId">
<input type="hidden" value="true" name="useSecure">
<input type="hidden" value="2" name="loginType">
<input type="hidden" name="action" value="loginAction">
<fieldset id="inputs">
<input id="txtUserIdGutter" class="InputText" type="text" name="Email" placeholder="Your email address" required>
<input id="txtPasswordGutter" class="InputText" type="password" name="Password" placeholder="Password" required>
</fieldset>
<fieldset id="actions">
<input type="submit" id="submit" value="Log in">
<label><input type="checkbox" checked="checked"> Keep me signed in</label>
<label>Forgot Password?</label>
</fieldset>
</form>
</div>
</li>
</ul>
</div>
Take out your extra <form> tag.
<div id="login-content">
<!-- Remove this line: --> <form>
<form action="https://na6.salesforce.com/secur/login_portal.jsp" method="POST">
When the page refreshes, it's supposed to hit your code behind.
Do you have a log line or a breakpoint that you expect your code to be called?
Also, you have double form tags:
<form><form action="https://na6.salesforce....
Try to remove the first one.

Two html forms on one page; Can only select second form fields with tab

I have a a page with two forms on it. I can only click inside the input boxes of one form. For the other form, I can select the input boxes but only if I use tab. Is there anyway I can fix this? The site is http://login.peakperformancecct.com/. Just for reference, here is my code:
<div class="login">
<h1>Email Login</h1>
<form name="emaillogin" id="loginform" action="http://www.nspirelab.com:2095/login" method="POST">
<p>
<label for="user">Email Address<br />
<input class="input" id="user" name="user" type="text" value="" size="20" /></label>
</p>
<p>
<label for="pass">Password<br />
<input id="pass" name="pass" class="input" type="password" size="20" /></label>
</p>
<p class="submit">
<input type="submit" class="button-primary" value="Log In" />
</p>
</form>
</div>
<div class="login">
<h1>Site Login</h1>
<form name="sitelogin" id="loginform" action="http://peakperformancecct.com/wp-login.php" method="post">
<p>
<label for="user">Username<br />
<input class="input" type="text" name="log" id="log" value="" size="20" /></label>
</p>
<p>
<label for="pass">Password<br />
<input class="input" type="password" name="pwd" id="pwd" size="20" /></label>
</p>
<p class="submit">
<input type="submit" name="submit" value="Log In" class="button-primary" />
</p>
</form>
</div>
Validate, validate, validate.
Your labels in the second form are for the inputs in the first form.
Clicking on the label sends the focus to the input with which it is associated
(Since the inputs are inside the labels, so you can't click on the input without clicking on the label too).