473,379 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

"input" inside "form" won't validate

Hi folks --

The page at

http://www.pwilson.net/submit-demo.html

will not validate. The validator at http://validator.w3.org tells me I
can't have an input inside a form.

Would some kind soul please tell me what I'm doing wrong?

Thanks!

-- Pete Wilson
Jul 23 '05 #1
11 4141
Previously in comp.infosystems.www.authoring.html, Pete Wilson
<pe**@pwilson.net> said:
Hi folks --
G'day.
http://www.pwilson.net/submit-demo.html

will not validate. The validator at http://validator.w3.org tells me I
can't have an input inside a form.
That's not quite what it is saying. It is saying you can't have an input
element *directly* within a form.
Would some kind soul please tell me what I'm doing wrong?


<form> cannot directly contain inline elements, so the <input> needs to
be inside another block element, such as <fieldset> or <div> (preferably
fieldset).

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 23 '05 #2
On 23 Nov 2004 14:42:33 -0800, Pete Wilson <pe**@pwilson.net> wrote:
The page at

http://www.pwilson.net/submit-demo.html

will not validate. The validator at http://validator.w3.org tells me I
can't have an input inside a form.

Would some kind soul please tell me what I'm doing wrong?


Strict HTML requires that the children of FORM elements may only be
block-level, or SCRIPT elements. An INPUT is neither. Contain the form
controls in a DIV, or a more meaningful element (if possible).

The BODY element has the same constraint.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3
Pete Wilson wrote:
The page at

http://www.pwilson.net/submit-demo.html

will not validate. The validator at http://validator.w3.org tells me I
can't have an input inside a form.


I think in Strict DTDs, you have to enclose the elements within a form
in a block level container. Try using a fieldset, e.g.

<form action="URL" method="get">
<fieldset>
<input....>
</fieldset>
</form>

--
Chris Simon
os******@slcszetnet.co.uk
http://www.users.zetnet.co.uk/csimon/

** Get rid of all SLCs to reply directly **
Jul 23 '05 #4
Pete Wilson wrote:
will not validate. The validator at http://validator.w3.org tells me I
can't have an input inside a form.

Would some kind soul please tell me what I'm doing wrong?


Forms have the same content model as the <body>. They can have block
elements as children but not inline elements. You need to put a block
element (or elements) (such as a <div>, <fieldset> or <table>) inside the
<form> and your <label>s and <input>s inside that.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #5
"Michael Winter" <M.******@blueyonder.co.invalid> wrote:
On 23 Nov 2004 14:42:33 -0800, Pete Wilson <pe**@pwilson.net> wrote:
The page at

http://www.pwilson.net/submit-demo.html

will not validate. The validator at http://validator.w3.org tells me I
can't have an input inside a form.

Would some kind soul please tell me what I'm doing wrong?
Strict HTML requires that the children of FORM elements may only be
block-level, or SCRIPT elements. An INPUT is neither. Contain the form
controls in a DIV, or a more meaningful element (if possible).


Such as a FIELDSET, a useful way to group controls inside a form, and
to label the groups using the LEGEND element.

The BODY element has the same constraint.

Mike

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #6
Chris Simon <os******@sclszetnet.co.uk> wrote:
<form action="URL" method="get">
<fieldset>
<input....>
</fieldset>
</form>


The fieldset element is for grouping related controls and labels, the
above is therefore inappropriate.

--
Spartanicus
Jul 23 '05 #7
Spartanicus wrote:
The fieldset element is for grouping related controls and labels, the
above is therefore inappropriate.


I assumed the provided page was a stripped-down version of a form to
demonstrate the problem, therefore the real page would indeed have
several related controls. The DTD requires that a block level element
should enclose all items within a form therefore you have several to
choose from. Is <p> appropriate? (It's not a paragraph of text). Is
<div> appropriate? (Maybe if it's a separate division of the document).
I would argue that fieldset is probably the most appripriate element to
use. I don't think that this point is really important - I pointed out
that a block level element is required and to try fieldset as an
example, it's up to the author to decide what element he uses.

What element would you use in this case?

--
Chris Simon
os******@slcszetnet.co.uk
http://www.users.zetnet.co.uk/csimon/

** Get rid of all SLCs to reply directly **
Jul 23 '05 #8
Chris Simon <os******@sclszetnet.co.uk> wrote:
The fieldset element is for grouping related controls and labels, the
above is therefore inappropriate.


I assumed the provided page was a stripped-down version of a form to
demonstrate the problem, therefore the real page would indeed have
several related controls. The DTD requires that a block level element
should enclose all items within a form therefore you have several to
choose from. Is <p> appropriate? (It's not a paragraph of text). Is
<div> appropriate? (Maybe if it's a separate division of the document).
I would argue that fieldset is probably the most appripriate element to
use. I don't think that this point is really important - I pointed out
that a block level element is required and to try fieldset as an
example, it's up to the author to decide what element he uses.

What element would you use in this case?


Div, div's are non semantic nor do they signify any structure, so your
assertion that divs should only be used for "divisions" is incorrect.

--
Spartanicus
Jul 23 '05 #9
in comp.infosystems.www.authoring.html, Spartanicus wrote:
Div, div's are non semantic nor do they signify any structure


No, div is devined as grouping element. So it makes no sence to have
<div><img></div>, as you can't group one element.

But using div for that is much better than p for example

http://www.w3.org/TR/html4/struct/global.html#h-7.5.4
| The DIV and SPAN elements, in conjunction with the id and class
| attributes, offer a generic mechanism for adding structure to |
| documents.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 23 '05 #10
Spartanicus wrote:
Div, div's are non semantic nor do they signify any structure, so your
assertion that divs should only be used for "divisions" is incorrect.


Would you care to offer any practical advice instead of a robotic "your
statement is incorrect"? *I* think your statements are incorrect.

--
Chris Simon
os******@slcszetnet.co.uk
http://www.users.zetnet.co.uk/csimon/

** Get rid of all SLCs to reply directly **
Jul 23 '05 #11
Chris Simon <os******@sclszetnet.co.uk> wrote:
Div, div's are non semantic nor do they signify any structure, so your
assertion that divs should only be used for "divisions" is incorrect.
Would you care to offer any practical advice instead of a robotic "your
statement is incorrect"?


You asked what element I would use, I answered "div", how's that not
"practical"?
*I* think your statements are incorrect.


Fine, I don't care. If you want to start a discussion then you have to
do better. Provide an argument as to why you think I'm incorrect.

--
Spartanicus
Jul 23 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Hodad | last post by:
I would like to adapt, as much as possible, the appearance and color red of the font in this button: <P><CENTER><BUTTON VALUE="SUBMIT"><A...
3
by: Pavils Jurjans | last post by:
Hello, I have bumped upon this problem: I do some client-side form processing with JavaScript, and for this I loop over all the forms in the document. In order to identify them, I read their...
5
by: Werner Partner | last post by:
On my testpage http://www.sonoptikon.de/test.php I have this <table><tr> <td valign="top" align="center" style="width:150px;"> <form action=test.php method="get">
3
by: Jonathan | last post by:
Hi all: I originally posted this in an HTML forum, but have realized that the solution may (a) require a server-side change or (b) be non-existent. In any case, since the page I'm dealing with is...
2
by: lgo | last post by:
I have read several variations of this topic posted on this news group. However I was not able to find the answer for my problem. I am trying to build code (see below) to update a large single...
3
by: Pieter Coucke | last post by:
Hi, When a user types a non numeric-value in a numeric column in a DataGridView, and he tries to leave the cell, he gets this "Input string was not in a correct format."-exception. Is there a...
1
by: kbarrios | last post by:
Hi, I am working with VBScript and I put a "window.open" inside a "form action post" due that I am handing a "checkbox" on it, but the "window.open" doesn't work: <FORM...
1
by: chas2007 | last post by:
I need to pass a variable from a php function to a form. Does anyone have an example of code that would do this? Below is the code. I need to pass the "return value" from the php function mem_cost...
3
by: yawnmoth | last post by:
//form//input //form//select//option I can combine those with an or (|), but to make my code more concise, would it be possible to reuse the //form bit? Could I maybe do something like this,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.