I need to set up forms where some input fields are mandatory and
others are optional. A common convention is to place an asterisk on
the labels of the mandatory fields. Of course, I can just hard code
these asterisks, but I'd have thought it would be better to use a CSS
element to control how a mandatory field should be marked. For example
(using a table to lay out the fields):
<tr><td class=mandatory >Label 1:</td><td><input ....></td></tr>
<tr><td class=optional> Label 2:</td><td><input ....></td></tr>
I cannot find out how to set up a CSS element so that a piece of text
is added to the content.
(I realise it can be done with the :BEFORE pseudo-element, but it
doesn't work in IE6, which is the primary browser amongst users of
this site).
Any suggestions gratefully received. 6 4639
In our last episode,
<c5************ *************** *******@2g2000h sn.googlegroups .com>, the
lovely and talented Clive Backham broadcast on
comp.infosystem s. www.authoring.html:
I need to set up forms where some input fields are mandatory and
others are optional. A common convention is to place an asterisk on
the labels of the mandatory fields. Of course, I can just hard code
these asterisks, but I'd have thought it would be better to use a CSS
element to control how a mandatory field should be marked. For example
(using a table to lay out the fields):
><tr><td class=mandatory >Label 1:</td><td><input ....></td></tr> <tr><td class=optional> Label 2:</td><td><input ....></td></tr>
I cannot find out how to set up a CSS element so that a piece of text
is added to the content.
You cannot use CSS to add text to an element. You could use CSS to display
(or not) text that is already there:
<tr><td class=mandatory ><span>*</span>Label 1:</td><td><input ....></td></tr>
<tr><td class=optional> <span>*</span>Label 2:</td><td><input ....></td></tr>
..optional SPAN { display: none; }
In this case, you hide the asterisk for optional fields. But the asterisk
is in the text and will show in text browsers or when CSS is off.
There are also various tricks you can do with images, such as adding an
image with an asterisk as background to elements that are mandatory. This
too breaks more-or-less horribly in text browsing and requires special
attention if the page is to be printed successfully.
In both cases, CSS did not add text. In one case it hid text. In the other
it added a background image. CSS cannot alter the text.
(I realise it can be done with the :BEFORE pseudo-element, but it
doesn't work in IE6, which is the primary browser amongst users of
this site).
Any suggestions gratefully received.
--
Lars Eighner <http://larseighner.com/ us****@larseigh ner.com
Love: The warm feeling you get towards someone who meets your neurotic needs.
Lars Eighner wrote:
In both cases, CSS did not add text. In one case it hid text. In the other
it added a background image. CSS cannot alter the text.
Well, yes, it *can* add text, using the content property with the
:before and :after pseudoelements, as the OP pointed out--when that
feature is supported, which it isn't in IE6 or IE7.
Clive Backham wrote:
I need to set up forms where some input fields are mandatory and
others are optional. A common convention is to place an asterisk on
the labels of the mandatory fields. Of course, I can just hard code
these asterisks, but I'd have thought it would be better to use a CSS
element to control how a mandatory field should be marked. For example
(using a table to lay out the fields):
<tr><td class=mandatory >Label 1:</td><td><input ....></td></tr>
<tr><td class=optional> Label 2:</td><td><input ....></td></tr>
I cannot find out how to set up a CSS element so that a piece of text
is added to the content.
(I realise it can be done with the :BEFORE pseudo-element, but it
doesn't work in IE6, which is the primary browser amongst users of
this site).
Yes, that *is* the way to do it in CSS and, yes, it doesn't work in IE,
so practically speaking you're out of luck.
However, given that your indicating whether a field is mandatory or not
is a significant piece of information, not just a stylistic detail, it
makes perfectly good sense to represent that information in the HTML and
not relegate it to the CSS.
Thanks to all who have replied.
On 16 Sep, 13:32, Harlan Messinger <hmessinger.rem ovet...@comcast .net>
wrote:
However, given that your indicating whether a field is mandatory or not
is a significant piece of information, not just a stylistic detail, it
makes perfectly good sense to represent that information in the HTML and
not relegate it to the CSS.
I understand where you're coming from. My rationale in wanting to use
CSS was that if for some reason in the future I decide (or am asked)
to change the visual indicator from an asterisk to something else, it
would be a lot easier to edit one CSS element definition than change
the text in possibly dozens of HTML files. Or am I missing something?
Gazing into my crystal ball I observed Clive Backham
<go****@delback .co.ukwriting in news:2ba0367c-87a5-43c1-ac4f- 4f**********@k3 0g2000hse.googl egroups.com:
Thanks to all who have replied.
On 16 Sep, 13:32, Harlan Messinger <hmessinger.rem ovet...@comcast .net>
wrote:
>However, given that your indicating whether a field is mandatory or
not
>is a significant piece of information, not just a stylistic detail,
it
>makes perfectly good sense to represent that information in the HTML
and
>not relegate it to the CSS.
I understand where you're coming from. My rationale in wanting to use
CSS was that if for some reason in the future I decide (or am asked)
to change the visual indicator from an asterisk to something else, it
would be a lot easier to edit one CSS element definition than change
the text in possibly dozens of HTML files. Or am I missing something?
I usually do something like:
<label class="required " for="field" id="field1">Fie ld *</label>
..required {font-weight:bold; color: red;}
Users with CSS enabled will get a bold red label, and users without will
still get the asterisk, or as my Puerto Rican friend used to say "Leetel
Star" (from Greek asteriskos, literally, little star, diminutive of
aster-, aster).
--
Adrienne Boswell at Home
Arbpen Web Site Design Services http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Clive Backham wrote:
Thanks to all who have replied.
On 16 Sep, 13:32, Harlan Messinger <hmessinger.rem ovet...@comcast .net>
wrote:
>However, given that your indicating whether a field is mandatory or not is a significant piece of information, not just a stylistic detail, it makes perfectly good sense to represent that information in the HTML and not relegate it to the CSS.
I understand where you're coming from. My rationale in wanting to use
CSS was that if for some reason in the future I decide (or am asked)
to change the visual indicator from an asterisk to something else, it
would be a lot easier to edit one CSS element definition than change
the text in possibly dozens of HTML files. Or am I missing something?
Use a server-side include. Or create a server-side variable to contain
the asterisk and insert the variable everywhere in server-side code. ASP
example:
dim reqMark
reqMark = "*"
...
E-mail address<%=reqMa rk%>: <input ... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Werner Partner |
last post by:
I'm looking for something like that:
http://www.sonoptikon.de/praxis-mt/test.php
The text should have a certain indent, and from the left border should
come a "marker" which goes over the text for a certain length. Please
don't look at the source text, ;-) it's terrrible, but I just wanted to
show how about it should look like.
Of course in my test case I cannot realize two features:
- the couloured marker should always have same...
|
by: kj |
last post by:
I have elements of the form
<TD><A name="marker"></A>foobar</TD>
and I want to extract the text "foobar". How can I do this in IE?
(I think I know how to do it for NS). Is there a way to implement
this that is reasonably browser-independent?
Many thanks!
|
by: crjunk |
last post by:
I have 4 TextBoxes on my form that I'm trying to add together to get a
grand total. Here is the code I'm using:
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -
function calcTotalPub()
{
var tempFed = +document.Form1.value;
var tempState = +document.Form1.value;
|
by: Mickey |
last post by:
Hi,
I have a script which works in both IE but is sluggish in Firefox.
The script is a simple text scroller.
It works perfectly in IE however in Firefox, the text scroll slower and
eventually just stops.
I would aprechiate it someone could look at the code below and maybe
see where the problem is?
|
by: Michelle |
last post by:
I have a div that is initially empty. Clicking on a button will add some
text boxes and other controls so the user can add additional records. In
IE
all works fine but in Netscape 7.0 when I add another "record" the values
for all previous controls within the div are wiped out. In the javascript
function where I add on to the html in the div if I capture all the data in
the previous "records" then after adding the new record I can...
| |
by: Trevor |
last post by:
Hey,
I am trying to do this tutorial on the microsoft site :
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dndotnet/html/usingadonet.asp
I can get everything to work up to the DataAdd part
(Section heading is Adding Rows to a DataSet)
I dont really know what to do after i have added all the
|
by: Paul_Madden via DotNetMonster.com |
last post by:
Basically I have a listbox to which I add simple STRING items- I have a
progress bar which I increment whenever I populate another portion of the
complete set of items I wish to add. What I observe is that as more and more
are added, population of the list box takes longer and longer. ie the first
10th of the item set are added much much quicker than the last 10th. THis
occurs with about 40,000 listbox items. My worry is the listbox may...
|
by: SAM |
last post by:
rfr a écrit :
This below works for me in Firefox,
you can put this script in the head of your page(s)
<script language="JavaScript1.2" type="text/javascript">
// Based on watermark script by Paul Anderson, CNET Builder.com.
// All rights reserved.
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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...
| |