Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-13-2012, 06:42 PM   PM User | #16
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Code:
<br/>Email Address: <br /> &nbsp; <input type="text" id="email"> <br />
id= should be name= to make your code fragment work. Personally I tend to use both id and name and give them the same value (except for grouped elements - radio buttons, etc.. - because ids must be unique).
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 12-13-2012 at 06:45 PM..
AndrewGSW is offline   Reply With Quote
Old 12-14-2012, 01:56 AM   PM User | #17
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,556
Thanks: 62
Thanked 4,056 Times in 4,025 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Yep, Andrew saw it.

Too much copy, not enough editing on my part. Should have been.
Code:
            <br/>Email Address: <br /> &nbsp; <input type="text" name="email"> <br />
But I disagree with Andrew: I *NEVER* give an ID to form fields unless there is some very good reason. Granted, 99% of everything I do with <form>s has to interact with server-side code, and fields without names are useless for that purpose. But even so, you don't need an ID to reference any <form> field, so why bother?

Almost the only exception is when I use <label for="someID"> in which case of course there must be a matchind ID. But even then, I tend to use <label> with the for= property.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Tags
error, form, javascript, syntax, validation

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 04:05 PM.


Advertisement
Log in to turn off these ads.