Element input not allowed in xhtml body
this is a bit of the code after placing javascript into it, this error appeared.
<p class="submit" />
<input type="submit" name="commit" value="Submit" id="submit" />
<button type="reset" value="Clear">Clear</button></p>
</body>
You didn't provide your entire HTML, so I cannot say for the entire document. Based on what you have provided, here are the issues:
<p class="submit" /> <---- YOU ARE CLOSING THE PARAGRAPH TAG
<input type="submit" name="commit" value="Submit" id="submit" />
<button type="reset" value="Clear">Clear</button></p> <---- YOU THEN CLOSING THE PARAGRAPH TAG AGAIN
</body>
Make the following changes:
<p class="submit">
<input type="submit" name="commit" value="Submit" id="submit" />
<button type="reset" value="Clear">Clear</button>
</p>
</body>
You can also validate your code here: http://validator.w3.org/check
You need to enclose input tag inside a div or fieldset, also you have closed p tag incorrectly. Check this links Why is an input tag not allowed directly within a form tag?, I hope it will be clear to you.
Related
Trying to build a 3 control input-group with Bootstrap 3.3.7, however the height of the first addon does not match the following input nor button.
<div class="input-group">
<span class="input-group-addon">Amount</span>
<input type="text" class="form-control" />
<div class="input-group-btn">
<button class="btn">Submit</button>
</div>
</div>
Anyone have a working sample to solve this design?
First and for all where is your <label> tag?
Do you want the submit in your input field? Or the submit button underneath it?
You need also to place form around it and your input can be declared as number because it's amount; your input field also needs a name. A submit button is an input button with type='submit':
example:
<input type="submit" class="btn btn-default" value="submit" id="submit">
You can also declare on your body class='container'
<body class="container">
<form id="youWantToGiveThisAName" class="form-group">
<label for="amountOfSomething"></label>
<div class="input-group">
<span class="input-group-addon">Amount</span>
<input type="number" name="amountOfSomething" id="amountOfSomething" class="form-control" value="0.00000121">
</div>
<div>
<input type="submit" class="btn btn-coinchecker pull-right" value="submit" id="submit">
</div>
</form>
</body>
Here's a fiddle to see the result
I am trying to add a bootstrap form in asp.net content page(.aspx). but it gives me an error regarding "Element form must not be nested with in a element form"
But i want to use the form element for a Login purpose in the page.
<div class="container">
<h2>Vertical (basic) form</h2>
<form>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" />
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<%-- --%>
</asp:Content>
Thanks in Advance
All asp webpages are already in a form, so you don't need the form tag, all you can do is instead of using, you can see the form tags at your main master page <form> you can use <div class="form"> hope this helps also for the best result
you should use CssClass instead of class in asp tags when adding the styling classes. e.g <asp:TextBox ID="TextBox14" runat="server" CssClass="form-control"></asp:TextBox>
you have simply use
<div class="container">
<h2>Vertical (basic) form</h2>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" />
</div>
<button type="submit" class="btn btn-default">Submit</button>
The message is clear.
Remove the extra form tags <form> and </form> from your code. Beside that your form did not post anywhere - use the asp.net form to post to code behind, you do not need other form there.
<form method="post" id="contactForm" action="#">
<fieldset>
<legend>Newsletter Signup</legend>
<p>To sign up for our fabulous campaign of useless information that you will never, ever read, please submit your email address here.</p>
<label for="email" id="emailLabel">Email</label>
<input type="text" id="email" />
<input type="button" name="submit" value="Submit" id="submitButton"/>
</fieldset>
</form>
So i need the paragraph to be on three separate lines but it has to be done with CSS.
If you only need it to be in 3 line but don't care where the lines break:
p{
width: 300px;
}
But this won't allow you to specify exactly where in the sentence the line breaks.
I've styled a domain search form with CSS and DIV tags, but it's not W3C compliant since I separated the form tags. How can I get around this and still be able to style each component of the form?
<div class="reg-domain-txt">
<span>Register Your Domain Name Today!</span>
</div>
<div class="checkerform">
<form action="https://www.xhostcompanyx.com/clients/domainchecker.php" method="post">
<input type="hidden" name="token" value="xxxxxxxxx" />
<input type="hidden" name="direct" value="true" />
<input class="inputbox" type="text" name="domain" size="29" />
</div>
<div class="tldboxlist">
<select class="tldbox" name="ext">
<option>.com</option>
<option>.net</option>
<option>.org</option>
<option>.biz</option>
<option>.us</option>
<option>.info</option>
<option>.mobi</option>
<option>.me</option>
<option>.co</option>
<option>.tv</option>
<option>.pro</option>
</select>
</div>
<div class="domaincheckbutton">
<input class="domainbutton" type="submit" value="Search" />
</form>
</div>
Just put the start and end form tags outside of the divs.
Please explain why this will prevent you from styling?
The code you’ve posted isn’t valid because you’ve opened a <div> tag, then opened a <form> tag, then closed the <div> tag before closing the <form> tag. You can’t do that with any tags in HTML.
Here’s your HTML, corrected and indented — indentation really helps make these kinds of HTML errors more obvious:
<div class="reg-domain-txt">
<span>Register Your Domain Name Today!</span>
</div>
<div class="checkerform">
<form action="https://www.xhostcompanyx.com/clients/domainchecker.php" method="post">
<input type="hidden" name="token" value="xxxxxxxxx" />
<input type="hidden" name="direct" value="true" />
<input class="inputbox" type="text" name="domain" size="29" />
<div class="tldboxlist">
<select class="tldbox" name="ext">
<option>.com</option>
<option>.net</option>
<option>.org</option>
<option>.biz</option>
<option>.us</option>
<option>.info</option>
<option>.mobi</option>
<option>.me</option>
<option>.co</option>
<option>.tv</option>
<option>.pro</option>
</select>
</div>
<div class="domaincheckbutton">
<input class="domainbutton" type="submit" value="Search" />
</div>
</form>
</div>
I would remove the three DIVs. They are not necessary for content or styling. If you need to group together form elements, you should use the FIELDSET tag. Also, if you need to position the entire form, you can give the form an ID or a Class.
When label tag should be used over span or dev in form?
Example:
option1-span:
<form action="">
<span>Name:</span><input type="text">
<input type="submit" />
</form>
option2-label:
<form action="">
<label>Name:</label><input type="text">
<input type="submit" />
</form>
option3-div:
<form action="">
<div style="display:inline;">Name:</div><input type="text">
<input type="submit" />
</form>
Thanks
This is what label tags are for:
<form action="">
<label for="txt">Name:</label><input type="text" id="txt" name="txt" />
<input type="submit" />
</form>
Then clicking on the label will focus on the input element.
The label tag is primarily used along with the for attribute. This aids in web accessibility of forms. For example
<form>
<label for="firstName">First name:</label>
<input type="text" name="firstName" value=""/>
</form>
By using the for tag, we can essentially associate the text "First Name:" with the input field having the name = "firstName".
Aside from that it has other attributes allowed but the span is more regularly used for styling markup.