Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > form </input> validation

Reply
Thread Tools

form </input> validation

 
 
jp2code
Guest
Posts: n/a
 
      09-13-2007
I have several input fields on my form, and the form works; however, Visual
Studio is showing errors, and I would like to get rid of them.

When the form is submitted, it is redirected back to itself, where it checks
the values that were entered.

If the default values are set, this is the visitor's first time to access
the page.

Example: The FirstName field would initially be displayed with "First Name;"
but, this value would not be valid for submitting the form.

If non-default values are available, they are validated before being
collected (i.e. FirstName can not be blank).

If a page is not valid, a note is displayed next to the failed fields and
all fields are populated with their previous values.

Example:
<input type="text" name="FirstName"><%Request.Form("FirstName")%></input>
<span><%Response.Write(strFirstNameErr)%></span>

For my html header, I use this format:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

Visual Studio is giving me this error for the </input> tags:

Validation (XHTML 1.0 Transitional): Element 'input' is an empty element and
cannot have a closing tag. Instead, it must end with />.

What is the best way to correct this?


 
Reply With Quote
 
 
 
 
Bob Milutinovic
Guest
Posts: n/a
 
      09-13-2007
"jp2code" <poojo.com/mail> wrote in message
news:...
>
>I have several input fields on my form, and the form works; however, Visual
>Studio is showing errors, and I would like to get rid of them.


Add/Remove Programs -> Remove Visual Studio

>
> When the form is submitted, it is redirected back to itself, where it
> checks the values that were entered.
>
> If the default values are set, this is the visitor's first time to access
> the page.
>
> Example: The FirstName field would initially be displayed with "First
> Name;" but, this value would not be valid for submitting the form.
>


A far better approach would be to check the value of the "submit" button.

> If non-default values are available, they are validated before being
> collected (i.e. FirstName can not be blank).
>
> If a page is not valid, a note is displayed next to the failed fields and
> all fields are populated with their previous values.
>
> Example:
> <input type="text" name="FirstName"><%Request.Form("FirstName")%></input>
> <span><%Response.Write(strFirstNameErr)%></span>
>
> For my html header, I use this format:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" >
>
> Visual Studio is giving me this error for the </input> tags:
>
> Validation (XHTML 1.0 Transitional): Element 'input' is an empty element
> and cannot have a closing tag. Instead, it must end with />.
>
> What is the best way to correct this?


<input type="text" name="FirstName" value="<%=Request.Form("FirstName")%>"
/>

--
Bob Milutinovic
Cognicom - "Australia's Web Presence Specialists"
http://www.cognicom.net.au/
telephone (0417) 45-77-66
facsimile (02) 9824-2240


 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      09-14-2007
Gazing into my crystal ball I observed "jp2code" <poojo.com/mail>
writing in news::

> For my html header, I use this format:
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
><html xmlns="http://www.w3.org/1999/xhtml" >
>
> Visual Studio is giving me this error for the </input> tags:
>
> Validation (XHTML 1.0 Transitional): Element 'input' is an empty
> element and cannot have a closing tag. Instead, it must end with />.
>
> What is the best way to correct this?
>
>


1. Use a strict DocType for new documents - Transitional is for older
documents that are in Transition.
2. Better to use HTML instead of XHTML - unless you have a compelling
reason (other than being trendy) - lurk over at alt.html for reasons
why.
3. If you must use XHTML, then understand:
A) All elements must be closed.
B) Elements and attributes must be in lower case
C) Elements which do not have a corresponding end tag use a slash at the
end of the tag, eg. <img src="mypic.gif" alt="Nice picture" />

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
jp2code
Guest
Posts: n/a
 
      09-14-2007
Nice crystal ball, Adrienne!

As for specifying Transitional and XHTML, I'm just using something I found
on another's HTML page.

How would I code my HTML using DocType and HTML? Any suggestions? I take
them, you know!

"Adrienne Boswell" saw this a ball O'crystal:
> 1. Use a strict DocType for new documents - Transitional is for older
> documents that are in Transition.
> 2. Better to use HTML instead of XHTML - unless you have a compelling
> reason (other than being trendy) - lurk over at alt.html for reasons
> why.
> 3. If you must use XHTML, then understand:
> A) All elements must be closed.
> B) Elements and attributes must be in lower case
> C) Elements which do not have a corresponding end tag use a slash at the
> end of the tag, eg. <img src="mypic.gif" alt="Nice picture" />



 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      09-14-2007
Gazing into my crystal ball I observed "jp2code" <poojo.com/mail>
writing in news::

> Nice crystal ball, Adrienne!
>
> As for specifying Transitional and XHTML, I'm just using something I
> found on another's HTML page.
>
> How would I code my HTML using DocType and HTML? Any suggestions? I
> take them, you know!
>


http://www.w3.org/QA/2002/04/valid-dtd-list.html

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A form validation library with javascript validation Grigory Temchenko Python 0 12-28-2008 08:38 PM
string validation/ form validation OriginalBrownster Python 1 08-21-2006 01:50 AM
Struts validation for combine form fields validation Sumith Mathur Java 0 09-23-2004 06:26 PM
Form Validation Problem...Persisiting form fields on validation failure. bnp Javascript 4 05-12-2004 12:16 PM
Web form validation vs object validation Colin Basterfield ASP .Net 1 11-29-2003 12:10 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57