From: The Natural Philosopher on
Ok, this is a very general question. I am designing the public facing
part of a sales website, and want to be as compatible as I can with
everybody, as opposed to the internal side,where I used what was in
house standard to full effect.

In a way this is an odd post, because its about NOT using javascript.

Let me explain. To date, the simplest way of making anything 'do
something' when clicked, was to attach a basic event handler, and call a
URL and set one or more post variable using js.

Now, if I posit 'javascript off' I must needs do it with straight URLS,
and only GET variables embedded in it to control server side behaviour.

Or is there a way to set up one or more POST variables from a click on a
URL? I am not totally enamoured with multiple submit buttons either..
but its a possibility..

How do others approach this problem, and why?

On a similar note, I guess there is no way to have flyout menus without
a server reload..if js is off, either..

Or should I just say 'sod it: if they want to use this site, its JUST
possible without JS, but its ugly and clunky, and its there fault for
not turning it on' ?
From: JR on
On Dec 22, 12:25 pm, The Natural Philosopher <t...(a)invalid.invalid>
wrote:

> In a way this is an odd post, because its about NOT using javascript.
>
> Let me explain. To date, the simplest way of making anything 'do
> something' when clicked, was to attach a basic event handler, and call a
> URL and set one or more post variable using js.
>
> Now, if I posit 'javascript off' I must needs do it with straight URLS,
> and only GET variables embedded in it to control server side behaviour.
>
> Or is there a way to set up one or more POST variables from a click on a
> URL?  I am not totally enamoured with multiple submit buttons either..
> but its a possibility..
>
> How do others approach this problem, and why?
>
> On a similar note, I guess there is no way to have flyout menus without
> a server reload..if js is off, either..
>
> Or should I just say 'sod it: if they want to use this site, its JUST
> possible without JS, but its ugly and clunky, and its there fault for
> not turning it on' ?

It's possible to develop a website without using javascript in the
client-side. Take a look at Amazon and Google Maps for instance: they
don`t look `ugly and clunky` without JS. Menus can be achieved with
CSS only. But `post` can only be used within a form, I think.

Cheers,
JR
From: Erwin Moller on
The Natural Philosopher schreef:

Hi TNP,

> Ok, this is a very general question. I am designing the public facing
> part of a sales website, and want to be as compatible as I can with
> everybody, as opposed to the internal side,where I used what was in
> house standard to full effect.
>
> In a way this is an odd post, because its about NOT using javascript.
>
> Let me explain. To date, the simplest way of making anything 'do
> something' when clicked, was to attach a basic event handler, and call a
> URL and set one or more post variable using js.
>
> Now, if I posit 'javascript off' I must needs do it with straight URLS,
> and only GET variables embedded in it to control server side behaviour.

And a lot more of course.
You have forms with all kind of elements in it: radiobutton, checkboxes,
etc. Using them smart can make things easy and intuitive for the user,
even with JavaScript disabled.

About the GET, I prefer putting everything in a POST instead of GET.
When some elements contain a lot of characters (textarea for example)
GET will get you in trouble on some setups. (If memory serves me well:
IIS used to accept 2048 characters or something as a maximum in the URL
itself).

And you can always write info from the URL inside the forms, using
hidden variables.


>
> Or is there a way to set up one or more POST variables from a click on a
> URL? I am not totally enamoured with multiple submit buttons either..
> but its a possibility..


Without JavaScript you MUST solve your problems with the standard
elements in the form. So if you need more submitbuttons, do that. :-)
For example:
<input type="text" name="whatever">
<input type="submit" name="submitbutton" value="update">
<input type="submit" name="submitbutton" value="delete"
style="background:#FF0000;">

is perfectly easy to understand for the user I expect.
At the server you simply get the value for submitbutton and do your stuff.
I have no problems with multiple submitbutton. Do you?


>
> How do others approach this problem, and why?


The best approach is to code for both JavaScript enabled visitors and
disabled visitors alike.
I have been in situations where I found it easier to branch my scripts:
One for enabled, one for disabled: It is not a great solution, but I had
cases where I needed loads of happy complex (for me) JavaScript that
could drag and drop, place images over others, etc.
The JS-disabled version only needed 2 coordinates, so I thought
branching the pages I served was easier.

However, in most (even all I expect) cases it is possible to write one
page that handles both enabled and disabled JavaScript fine.


>
> On a similar note, I guess there is no way to have flyout menus without
> a server reload..if js is off, either..

That IS possible with CSS.
You don't need JavaScript at all for that.
Google for: css drop down menu no javascript

(HTML5 will support this kind of menus without css, but that is of no
use for you now.)


>
> Or should I just say 'sod it: if they want to use this site, its JUST
> possible without JS, but its ugly and clunky, and its there fault for
> not turning it on' ?


In the end, that is for your client to decide.
Estimates I heard are that 2% to 8% have JavaScript disabled.
But it is hard to get reliable numbers on that I understood, so make up
your own mind.

Telling them to sod it might result in 2-8% lower sales.

I have made sites that were only usable with JavaScript enabled. If my
client wants that and don't want to spend a dime extra for the
JavaScript disbled browsers, I make it like that even tough I dislike it.

In my opinion it is often possble to code for both situations straight
away with little extra effort, like form validation.
I know you are a PHP programmer, so you do the serverside validation
anyway.
It is not hard at all to return the form with problematic fields
highlighted, and only accept at the server when they are fine.

But that is formvalidation. I am not sure what it is you are working on
excactly now, maybe there is more involved.


Just my 2 cent.

Regards,
Erwin Moller


--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
From: Doug Miller on
In article <hgqks3$esq$1(a)news.albasani.net>, The Natural Philosopher <tnp(a)invalid.invalid> wrote:
>Ok, this is a very general question. I am designing the public facing
>part of a sales website, and want to be as compatible as I can with
>everybody, as opposed to the internal side,where I used what was in
>house standard to full effect.
>
>In a way this is an odd post, because its about NOT using javascript.
>
>Let me explain. To date, the simplest way of making anything 'do
>something' when clicked, was to attach a basic event handler, and call a
>URL and set one or more post variable using js.
>
>Now, if I posit 'javascript off' I must needs do it with straight URLS,
>and only GET variables embedded in it to control server side behaviour.

Why "only GET" ?
>
>Or is there a way to set up one or more POST variables from a click on a
>URL? I am not totally enamoured with multiple submit buttons either..
>but its a possibility..

Of course. Submit buttons, multiple or otherwise, implies the use of a <form>;
you can certainly use method="post", which gives you one POST variable for
each named <input> element in the form.
>
>How do others approach this problem, and why?

One approach: server-side scripting (PHP or ASP) using POST variables.
Reasons: faster execution, better security, works even if user has JS
disabled.
>
>On a similar note, I guess there is no way to have flyout menus without
>a server reload..if js is off, either..

Sure there is. Flyout menus can be achieved with pure CSS, and no JS at all.
>
>Or should I just say 'sod it: if they want to use this site, its JUST
>possible without JS, but its ugly and clunky, and its there fault for
>not turning it on' ?

I would say it's the developer's fault for not making a site that will
function even without JS.
From: Swifty on
JR wrote:
> But `post` can only be used within a form, I think.

Indeed, but if you *want* the "Submit" button to look like a link, you
can do that simply enough with CSS (I could do it, which is my
definition of "simply enough").

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk