Prev: JavaScript code mangler / scrambler / ... khm, more than obfuscator... :)
Next: Simple Ajax question.
From: The Natural Philosopher on 22 Dec 2009 16:33 Erwin Moller wrote: > 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. > Oh I use all that already. > 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. > well no, typically without JS you cant. You can at best set one post variable per submit button. Not half a dozen after a lot of logic ;-) Not insuperable..but the dirt all goes to the server. > >> >> 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? > I have a problem with submit buttons AT ALL in that they are limited in stylistic capabilities. And then someone hits the 'enter' key.. > >> >> 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. > Nice trick. I'll tuck that one away..for later. > 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 > Hmm. how do you toggle visible/invisible without JS? > (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. > Ok Fairy Nuff! > 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. > Worth a few dollars at least. As usual, thought provoking, clear and helpful. Thanks. > Regards, > Erwin Moller > >
From: The Natural Philosopher on 22 Dec 2009 16:39 Doug Miller wrote: > 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. I think I dint make myself clear. With js I can fire an evfent handler., set any amount of post variables, and do a submit. I can even submit to a totally different target or spawn a popup window. With strict HTML one button=one vale, and unless I use two forms, one target URL and no spaewning of windows. With a straight URL I can spawn a window, but how to pass variables to it? Except with 'get' Cookies? >> 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. Well I do that already. However its a page load every time, and that gets clunky. This server for other reasons sits on a slow link. >> 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. Well Its certainly worth making the attempt I suppose. You are damned if you do ('doesn't work properly without java script') and damned if you dont ('its dull and old fashioned and slow') There's a LOT of sites out there than ONLY work on IE5/6/7/8
From: The Natural Philosopher on 22 Dec 2009 16:43 Swifty wrote: > 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"). > Problem I have with the submit button, is that if you style it with an image of non square shape, with a transparent edge to it, what shows through is NOT the background image of the containing element, but the plain background COLOR of the containing element. Or possibly the background color of the button itself. Hmm. Perhaps that's the problem. Can you set a style to 'background color: transparent ?
From: Doug Miller on 22 Dec 2009 22:20 In article <8149389.y0nniJfEyV(a)PointedEars.de>, Thomas 'PointedEars' Lahn <cljs(a)PointedEars.de> wrote: >Doug Miller wrote: > >> Thomas 'PointedEars' Lahn wrote: >>> Doug Miller wrote: >>>> The Natural Philosopher wrote: >>>>> I think I dint make myself clear. With js I can fire an evfent > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>>>> handler., set any amount of post variables, and do a submit. I can even > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>>>> submit to a totally different target or spawn a popup window. >>>>> >>>>> With strict HTML one button=one vale, >>>> No. The array of POST variables sent to the server includes all named >>>> input elements in the form, regardless of how many submit buttons there >>>> are. >>> There is no "array of POST variables". >> >> From the perspective of a server-side script, there certainly is (e.g. >> $_POST in PHP). > >The perspective was not any server-side application here. Actually, yes it was, since the OP was asking how to accomplish a task *without* using javascript, and my discussion with him described in a general way how to manage it using server-side scripting. > >>> The message body of an HTTP POST >>> request is a string, with a HTML form it is usually >>> >>> name1=value1&name2=value2 >>> >>> etc., with names and values URL-encoded. It is only the server-side >>> application, e.g. PHP, that makes an (associative) array (e.g., >>> $HTTP_POST_VARS or $_POST) out of it. >> >> I'm afraid you've missed the point altogether, which is that I was >> correcting the previous poster's misapprehension that only one value could >> be transmitted per submit button. > >No, I did notice that. Your answer was partially wrong anyway (as the >question was completely wrong). Wrong in what way, pray tell?
From: Doug Miller on 22 Dec 2009 19:54
In article <hgrehi$rlh$1(a)news.albasani.net>, The Natural Philosopher <tnp(a)invalid.invalid> wrote: >Swifty wrote: >> 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"). >> >Problem I have with the submit button, is that if you style it with an >image of non square shape, with a transparent edge to it, what shows >through is NOT the background image of the containing element, but the >plain background COLOR of the containing element. Or possibly the >background color of the button itself. Hmm. Perhaps that's the problem. Perhaps the problem is how you've defined the button.Do you have <input type="submit"...> or <input type="image"...> ? |