Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Slightly ugly output

Reply
Thread Tools

Re: Slightly ugly output

 
 
Denis McMahon
Guest
Posts: n/a
 
      08-02-2010
On 02/08/10 18:52, Jonathan N. Little wrote:
> lrhorer wrote:


>> I already mentioned that. More than once, and the first time
>> in the
>> very first paragraph of my very first post. Sixth sentence. It
>> requires an additional intermediate script.

>
> Yes it does.
>
>> If there is no elegant way
>> to handle it otherwise, then to be sure I can handle it that way.

>
> Yes, it is what I have been telling you is the definitive solution. So
> go do it and move on.


It may not need an intermediate script.

eg:

<form method="whatever" action="processform.cgi">
<input type="submit" value="Submit" name="submitBtn">
<input type="submit" value="Abort" name="abortBtn">
</form>

at the start of processform.cgi, code along the lines of:

if abortBtn is defined in the received form data and contains the value
"Abort" then invoke the abort cgi handler and exit, otherwise continue
with submit processing

Rgds

Denis McMahon
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      08-02-2010
Denis McMahon wrote:
> On 02/08/10 18:52, Jonathan N. Little wrote:
>> lrhorer wrote:

>
>>> I already mentioned that. More than once, and the first time
>>> in the
>>> very first paragraph of my very first post. Sixth sentence. It
>>> requires an additional intermediate script.

>>
>> Yes it does.
>>
>>> If there is no elegant way
>>> to handle it otherwise, then to be sure I can handle it that way.

>>
>> Yes, it is what I have been telling you is the definitive solution. So
>> go do it and move on.

>
> It may not need an intermediate script.
>
> eg:
>
> <form method="whatever" action="processform.cgi">
> <input type="submit" value="Submit" name="submitBtn">
> <input type="submit" value="Abort" name="abortBtn">
> </form>
>
> at the start of processform.cgi, code along the lines of:
>
> if abortBtn is defined in the received form data and contains the value
> "Abort" then invoke the abort cgi handler and exit, otherwise continue
> with submit processing



True, whether you creation one script that does all or a frontend to
call the others does not matter. The important point is one action per
form. The later method of a intermediate script just may be easiest to
deploy if the other two script are already written rather than recreate
the wheel. Have one script call another is no biggie.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
 
Denis McMahon
Guest
Posts: n/a
 
      08-02-2010
On 02/08/10 19:32, lrhorer wrote:
>> As an aside, buttons existed before radios.

>
> Radio buttons did not exist before radios, though, nor did html.
>
>> The history of a "radio
>> button" is that originally, on some types of radio, each "button" on a
>> radio would select a different channel, and you could only listen to

>
> I am aware of the history of the term. Thus my point.
>
>> one channel at once. Hence, on a radio as used in the term "radio
>> button" when referring to html, the button signifies an object where
>> you can only select one from many options.

>
> Properly, it is a button which, when pressed by the user causes the
> device (in this case a web page) to do something. It is a macroscopic
> term that is agnostic of the underlying mechanics. If it looks like a
> radio button and acts like a radio button, then it's a radio button.


No. In the context of html forms, a radio button is a specific type of
form input used for selecting one of many exclusive options.

It is not "a button that you press to do something" for any generic
value of "something", it is a button that specifically is used to select
one option from a group of mutually exclusive options.

A FORM SUBMIT BUTTON IS NOT A RADIO BUTTON!

Rgds

Denis McMahon
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      08-02-2010
In article <(E-Mail Removed)>,
Sherm Pendley <(E-Mail Removed)> wrote:

> Sort of - its name comes from the behavior of old-school radio preset
> buttons, where pushing one of them would result in the others popping
> out. Yes, I owned a car that had one of those... Get off my yard!


There was nothing so definite as this mechanical choosing and it
led to a more secure citizenry! The road rage one sees all around
these days is due to drivers' feeling jumpy, not really knowing
their place in the world. Yes, as a direct result of the prissy
modern electronic controls.

What will we have next, *gestures* to change stations, mumbling
voice controls where the damn radio is so smart that *it* will
pick up the insecurity of the driver and the feedback loops
between radio and driver will result in disaster: fatal accidents
with multiple deaths and injuries and family paybacks. The
direction this world is taking hardly bears thinking about.

Well, what is the point relevant here? What can web developers do
about this? Just this: when making forms, *please* embed definite
click sounds into the form so that choosing one thing makes a
definite impression. For the deaf, make the buttons such that the
clicked ones look definitely happy or alert and the others
decidedly disappointed or asleep.

--
dorayme
 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      08-05-2010

"lrhorer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> rf wrote:
>
>> Now, do you think it might be a good idea to take your code over to
>> the validator and fix *all* the errors?

>
> My engineering conscience got the better of me. I had a few minutes, so
> I took a look at the errors. In fact, there were very few in the
> script, but since the script looped numerous times, it generated lots
> of apparent errors. I fixed almost all of them. The validator still
> complains about a missing document type header, but since Apache barfs
> if I put anything but "Content-type: text/html" as the first line of
> the HTML section of the script, I really don't know of a way around it.


Er, Content-type: is an HTTP header, not part of the HTML. I don't know why
you need to be writing out your own headers, PHP for one does this for you.
What "script" language are you using?

But I'm talking about HTML validation. The HTML is the bit that comes after
the blank line that terminates the headers. The bit that should be:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>...
You should have a doctype in there, and a valid and full one, otherwise you
will be running the browsers in quirks mode, meaning that IE for one will
carefully reproduce all the bugs it has had back to version 5.5. It usually
means all bets are off as far as cross browser consistent layout of your
page is concerned.

Have a google for quirks mode. No, not quirksmode.com the web site although
that does make for a good read, look for quirks mode as against strict mode.


I see that you now have your submit and abort buttons nicely aligned. Good
work, and firebug now thinks you have exactly one form in there.

Do you really live with a girl called Tiffany? Quaint


 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      08-05-2010
In article <(E-Mail Removed)>,
Sherm Pendley <(E-Mail Removed)> wrote:

> The !DOCTYPE belongs on the first line,
> always, no exceptions.


No exceptions? What about like:

<?php $thisPage="black"; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

Does this cause harm?

--
dorayme
 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      08-05-2010

"dorayme" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In article <(E-Mail Removed)>,
> Sherm Pendley <(E-Mail Removed)> wrote:
>
>> The !DOCTYPE belongs on the first line,
>> always, no exceptions.

>
> No exceptions? What about like:
>
> <?php $thisPage="black"; ?>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
>
> Does this cause harm?


Why would it? The doctype is still the first line *in the HTML*.


 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      08-05-2010

"lrhorer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Sherm Pendley wrote:
>
>>> the !DOCTYPE declaration as the *SECOND* HTML line, after the Content
>>> marker. Everything I read was telling me to place it as the first
>>> line.

>>
>> What you've read is correct. The !DOCTYPE belongs on the first line,
>> always, no exceptions.

>
> If I do that, then it won't run at all, always, no exceptions. If
> the
> HTTP header does not precede every other HTML line, then the web server
> will barf on the file. If the first line of the file is not
>
> #! /bin/bash
>
> (or some other valid shell), then the file won't run at all.
>
>>>> carefully reproduce all the bugs it has had back to version 5.5. It
>>>> usually means all bets are off as far as cross browser consistent
>>>> layout of your page is concerned.
>>>
>>> Since I'm only using one browser, I really couldn't care much
>>> less
>>> about that, either.

>>
>> Okay, but *this group* does care. If you want bad advice that only
>> works in one browser, you'll need to go somewhere else to find it.

>
> So instead, I should take advice like that above, which won't work
> with
> any browser? I didn't ask for advice setting up my headers. Indeed,
> looking at your responses in this thread, I don't see any useful advice
> whatsoever, only criticisms. Perhaps in the past you have offered real
> advice, but one cannot judge that to be the case by your responses in
> this thread. Presuming this forum is indeed intended to be devoted to
> offering helpful advice, perhaps I am not the one who should seek
> another forum?


You are confused, and it's not Sherms fault.

Read my other post again. We are not talkinging about HTTP headers here. We
are talking about HTML.

Doctype is part of the HTML, not the HTTP headers.

Doctype must be the first line of the *HTML*.

[HTTP headers]
[one blank line]
[HTTP]

where [HTTP] looks similar to
<!DOCTYPE ...
<html>
<head>
....


 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      08-05-2010

"rf" <(E-Mail Removed)> wrote in message
news:SKH6o.2654$(E-Mail Removed) nd.com...
>
> "lrhorer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Sherm Pendley wrote:
>>
>>>> the !DOCTYPE declaration as the *SECOND* HTML line, after the Content
>>>> marker. Everything I read was telling me to place it as the first
>>>> line.
>>>
>>> What you've read is correct. The !DOCTYPE belongs on the first line,
>>> always, no exceptions.

>>
>> If I do that, then it won't run at all, always, no exceptions. If
>> the
>> HTTP header does not precede every other HTML line, then the web server
>> will barf on the file. If the first line of the file is not
>>
>> #! /bin/bash
>>
>> (or some other valid shell), then the file won't run at all.
>>
>>>>> carefully reproduce all the bugs it has had back to version 5.5. It
>>>>> usually means all bets are off as far as cross browser consistent
>>>>> layout of your page is concerned.
>>>>
>>>> Since I'm only using one browser, I really couldn't care much
>>>> less
>>>> about that, either.
>>>
>>> Okay, but *this group* does care. If you want bad advice that only
>>> works in one browser, you'll need to go somewhere else to find it.

>>
>> So instead, I should take advice like that above, which won't work
>> with
>> any browser? I didn't ask for advice setting up my headers. Indeed,
>> looking at your responses in this thread, I don't see any useful advice
>> whatsoever, only criticisms. Perhaps in the past you have offered real
>> advice, but one cannot judge that to be the case by your responses in
>> this thread. Presuming this forum is indeed intended to be devoted to
>> offering helpful advice, perhaps I am not the one who should seek
>> another forum?

>
> You are confused, and it's not Sherms fault.
>
> Read my other post again. We are not talkinging about HTTP headers here.
> We are talking about HTML.
>
> Doctype is part of the HTML, not the HTTP headers.
>
> Doctype must be the first line of the *HTML*.



Damn

[HTTP headers]
[one blank line]
[HTML]

where [HTML] looks similar to
<!DOCTYPE ...
<html>
<head>
....
>
>



 
Reply With Quote
 
Denis McMahon
Guest
Posts: n/a
 
      08-05-2010
On 06/08/10 00:02, lrhorer wrote:
> Sherm Pendley wrote:
>
>>> the !DOCTYPE declaration as the *SECOND* HTML line, after the Content
>>> marker. Everything I read was telling me to place it as the first
>>> line.

>>
>> What you've read is correct. The !DOCTYPE belongs on the first line,
>> always, no exceptions.

>
> If I do that, then it won't run at all, always, no exceptions. If the
> HTTP header does not precede every other HTML line, then the web server
> will barf on the file. If the first line of the file is not
>
> #! /bin/bash
>
> (or some other valid shell), then the file won't run at all.


Hold on ...

The http header is not what we're referring to by an html line.

What you're being told is that the <!DOCTYPE ....> declaration should
come before the opening <html> tag.

eg, the following parts should be output in the following sequence:

<!DOCTYPE ....>
<html>
<head>
<title>....</title>
</head>
<body>
</body>
</html>

Note that I haven't included various optional <head> elements or any
<body> elements, these of course can be inserted anywhere in that
sequence that they're valid.

There seems to be confusion about the html <head> and the http headers.

The http headers are text strings that exist outside the scope of the
html document (although meta elements in the html <head> element may use
http-equiv to emulate them).

The html <head> element is part of the document structure.

When a server responds to a request from a browser, first it sends http
headers, then it may send a document which, if it is html (as opposed to
say text, pdf, an image, some streaming audio or video etc) will contain
an <html>......</html> element, inside which is a head and a body
element, inside which is the content etc etc etc.

What you are being told is that you should send the "<!DOCTYPE.....>"
html element *before* the opening <html> tag of the document.

> So instead, I should take advice like that above, which won't work with
> any browser? I didn't ask for advice setting up my headers. Indeed,
> looking at your responses in this thread, I don't see any useful advice
> whatsoever, only criticisms. Perhaps in the past you have offered real
> advice, but one cannot judge that to be the case by your responses in
> this thread. Presuming this forum is indeed intended to be devoted to
> offering helpful advice, perhaps I am not the one who should seek
> another forum?


You're not being told to set a header, you're being told to send a
<!DOCTYPE....> element as the first element of your html document, that
is *before* the opening "<html>".

so, find the line in your cgi script that sends the text "<html>" and,
before that line, insert one to send "<!DOCTYPE.....>"

If that breaks apache, your apache is nerfed, as I have done this
successfully in cgi's I have written in perl, c, ada, fortran, lua,
python, pascal and bash script.

I got bored one day and decided to hello world in multiple languages,
then I went on to form processing ...

#!/bin/bash
echo "Content-type: text/html";
echo "";
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"
\"http://www.w3.org/TR/html4/strict.dtd\">";
echo "<html>";
echo "<head>";
echo "<title>First 'bash' cgi</title>";
echo "</head>";
echo "<body>";
echo "<p>Hello, World.</p>";
echo "</body>";
echo "</html>";

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"
\"http://www.w3.org/TR/html4/strict.dtd\">\n";
print "<html>\n";
print "<head>\n";
print "<title>First 'perl' cgi</title>\n";
print "</head>\n";
print "<body>\n";
print "<p>Hello, World.</p>\n";
print "</body>\n";
print "</html>\n";

etc etc etc

Rgds

Denis McMahon
 
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
Re: Slightly ugly output Andy HTML 11 08-04-2010 04:34 AM
Re: Slightly ugly output Denis McMahon HTML 2 08-02-2010 01:40 PM
get output of du / ls command - currently ugly code ... Esmail Python 2 08-13-2009 08:13 PM
The UGLY output from P&S superzooms Rich Digital Photography 34 12-23-2007 09:30 AM
Mozilla Firebird 0.7 has ugly font Nick de Graeve Firefox 1 02-03-2004 05:56 PM



Advertisments