Hi,
I'm not entirely sure this is the right group to ask this question, but I saw a similar one above, and the group's
charter is not clear enough about it, so, here I go: ;)
What is the standard behavior (if any) when the same name is attached to more than one field in a <form>?
An example (that closely resembles the problem I'm working on) will be (this is a standard radio group without a
default selected option):
<form ...>
<input type="radio" name="Q1" value="1"> opt 1
<input type="radio" name="Q1" value="2"> opt 2
...
<input type="radio" name="Q1" value="n"> Don't know
</form>
The idea is that, in our context "Don't know" and "Don't answer" are very different things, so we want to keep track
of both possibilities. Off course, adding a "Don't Answer" option, selected by default, looks odd as we are forcing the user
to actually give an answer. So "Don't Answer" should be actually that: leaving the question unanswered.
If the user only clicks "submit" we won't get any value for the field "Q1", what is the right behavior as there wasn't
a selected option.
Now, I have discovered that, if I add:
<input type="hidden" name="Q1" value="NoAns">
Right after the <form ...> tag, I get "NoAns" if the user didn't make a choice, and the value associated with the
selected option if she did. This holds for all the browsers I have tried so far (IE6, NN7, NN4, Opera 7). Nevertheless, I'm
not sure if this is the standard behavior (to send back the last value associated with the field name), and I've been unable
to find anything on the web about this type of situations (maybe I didn't look in the right place so a pointer to some source
of information will be a nice answer).
I reckon that it's probably a bad idea to replicate field names in a form (even more if they are of different
'types') but the alternative way through this problem (to add a hidden field with a list of the questions included in the page
and then modifying the associated CGIs to explicitly scan for those questions) will require major surgery in the whole project
something we cannot afford right now... :)
Thanks a lot, and please, *do* let me know if this question is off-topic, I don't want to make your lives miserable.
Andres.
--
Jul 20 '05
10 2883
Harlan Messinger <hm************ *******@comcast .net> wrote: Which is the specification for HTML 2, which was superseded four years ago by HTML 4, which states, "If no radio button in a set sharing the same control name is initially "on", user agent behavior for choosing which control is initially "on" is undefined."
That's rather obscure, since it means that the HTML 2 type behavior is
allowed, and the behavior of not having any button "on" is allowed
(though a pedant might claim otherwise - "which control" might be seen
as implying that one of them is initially "on"), _and_ a browser might
make the last button "on" by default, or something else. I don't think
they really meant that. They just couldn't decide between two behaviors
and allowed both, without realizing what else became permitted.
But it's a strong reason to always include an initially selected radio
button into each group of radio buttons. It's strange that authors miss
this simple principle.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JDS |
last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to
JavaScript:
I have a long, dynamically-generated form questionnaire. Not all of the
form fields are dynamically generated, though.
I'd like to capture the NAME of every HTML form field element on the
server, even if that element is submitted blank. The trouble is, with,
say, radio buttons or checkboxes for example, a *blank* element does not
get submitted at all.
|
by: Keith Wilby |
last post by:
I have a form which allows both form and datasheet views. My question is,
is it possible to control the field (column) names in datasheet view? What
happens at the moment is that the name is taken from a control's label if
there is one, and if not, the control's name is used.
This is confusing for my users so I'd like to be able to use more sensible
names in datasheet view. Is this possible?
Many thanks.
Keith.
|
by: Dixie |
last post by:
Can I set the Format property in a date/time field in code?
Can I set the Input Mask in a date/time field in code?
Can I set the Format of a Yes/No field to Checkbox in code?
I am working on a remote update of tables and fields and can't find enough
information on these things.
Also, how do you index a field in code?
|
by: sellcraig |
last post by:
Microsoft access
2 tables
table "data main" contains a field called "code"
table "ddw1" is created from a make table query of "data main"
Goal-
the data in "code" field in needs to be inserted into a standard web
address in the table (the filed name is link) in ddw1
Example address ---
|
by: marktxx |
last post by:
Although the C90 standard only mentions the use of 'signed int' and
'unsigned int' for bit-fields (use 'int' at your own risk) and C99
adds _Bool.
It seems that most compilers create the size of the bit-field object
from the size used to specify the field.
Could this be considered a defacto standard now (at least for 8 bit
sized bit-fields)?
Any recent compilers not allowing this?
| |
by: mcha226 |
last post by:
Hi All
I have to build a page which includes a select element (as a drop down
menu) with all the country names in it. However I just found out that
the need to be repeated many times so the client can select as many
country as they can in their around the world trip planning.
I don't want to repeat this long list multiple times, because I want
to save bandwidth. Is there a more efficient way to do this rather
than using JavaScript to...
|
by: Guy Macon |
last post by:
While I agree with the sentiment, the oringinal title on this thread
("OT: Specially for , why you should always use example.com
for obfuscating domains") is wrong. There are other reserved domain
names besides example.com.
The search for reserved domain names should start with RFC 2606
( http://www.faqs.org/rfcs/rfc2606.html ) which defines;
*.test
*.example
|
by: C#_Help_needed |
last post by:
I need help with the following question. THANKS :)
Write a program in c# that takes in a directory as a command line
parameter, and returns the longest repeated phrase in ALL text files
in that directory. Assume that all contents of all the files may be
held in memory at the same time. Do not use unsafe code blocks and/
or pointers.
|
by: dhtml |
last post by:
I have written an article "Unsafe Names for HTML Form Controls".
<URL: http://jibbering.com/faq/names/ >
I would appreciate any reviews, technical or otherwise.
Garrett
--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |