[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Single attributes
From: |
Quintin Connell |
Subject: |
Single attributes |
Date: |
Tue, 30 Apr 2002 15:54:07 +0200 (SAST) |
User-agent: |
IMP/PHP IMAP webmail program 2.2.6 |
A number of HTML attributes only require a name, and not a name = "value" pair.
Notably the selected, checked and readonly tags when dealing with forms. The
current behaviour if you set any of these is to get the following output in your
HTML <input type="text" name="txtBox" value="My Text" readonly="readonly" />.
This appears to work, esp for the checked and selected tags of radio buttons/
check boxes and select options. But I don't think this is quite what was
intended.
The HTMLAttribute class does provide a constructor that accepts one parameter,
but that parameter is mirrored to both the name and the value members. I
propose
a change as follows to the constructor
CGICCNS HTMLAttribute::HTMLAttribute(const STDNS string& name)
: fName(name),
fValue()
{}
and hence the render member function can be changed as follows:
void
CGICCNS HTMLAttribute::render(STDNS ostream& out) const
{
if (!getValue().empty()) {
out << getName() << "=\"" << getValue() << "\"";
}
else {
out << getName();
}
}
Which would then render the attribute as expected.
Quintin
- Single attributes,
Quintin Connell <=