dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: If Javascript is disabled...

  1. #1
    Join Date
    Apr 2010
    Posts
    2

    If Javascript is disabled...

    Hi,
    I'we got some questions about making sites to work even if JS is disabled/blocked.

    Now when i make forms, i just replace submit -> button and put javascript on it. So it doesn't submit and go through PHP validation, but this isn't sensible way cause if JS is blocked, site doesn't work at all. So how people handle this?

    - Is it possible to change input type? If JS is enabled, you could change all submits to buttons (using jQuery or something?), and if JS is blocked, those stays as submits and goes through PHP validation.

    - If form submit button has JS on it, can you block submit? So it would just go through JS and doesn't refresh whole page. If JS is blocked, it again would work as normal.

    - Third option what i thought was hidden submit inputs. If JS isn't blocked, it would show hidden buttons, but if JS is blocked it shows submits.

    So many ways to handle this thing, but what is the best and working way?

  2. #2
    Join Date
    Nov 2009
    Location
    Boston, MA, USA
    Posts
    52
    For navigation, the best strategy from a usability and SEO standpoint is to do the entire menu hard coded using CSS to style it with indents, etc. Then use JS to overwrite the CSS locally and toggle the display and/or visibility attributes in CSS to make menus accordion or fly out/down as desired.

    That way the menu fails totally gracefully when JS is disabled.

  3. #3
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    Your form should always go through serverside validation. JavaScript is just a convenience validation so the user is notified in a nicer manner.

    Eric

  4. #4
    Join Date
    Nov 2009
    Location
    Boston, MA, USA
    Posts
    52
    That is not possible in this case. The form is on a Yahoo Store. There is no active language available on the Store server. The query language, RTML, runs only at publish after a store owner has updated the database and reviewed all the changes on pages RTML produces in the back office.

    The form input gets validated by the separate server that runs the cart, but it's too late to let the user correct errors at that point. The back end will NOT throw out options where selection 0 is selected. I cannot even access the server that the cart runs on, so it is completely impossible to change that. The form verification I am looking for is intended to keep people from ordering items with "Please Choose" remaining selected for options, because every time that happens, the store owner must contact the buyer and find out what they really wanted for each option. JavaScript is my only possible way of doing this, and we just have to live with the instances where JS is disabled.
    Last edited by ETpro; 04-11-2010 at 02:44 PM.

  5. #5
    Join Date
    Mar 2010
    Location
    Singapore
    Posts
    367
    Whenever we do client side coding, we are bounded by the browser rules. If browser allow user the option to turn off Javascript or even Java, basically web-pages with Javascript cannot run and so does Java Applet.

    But at current age and time, I would presume most user will enable Javascript and Java.

    A classic example would be local banks in Singapore all uses Java Applet for the login page, so if you want to do internet banking, you got to install and enable Java isn't it ? I call such design as 'implicitly' forcing users to install and turn on Java.

    I have not found a case where Javascript is strictly needed. Anyone want to give example of how companies/institutions "implicitly" forcing users to turn on Javascript ?

  6. #6
    Join Date
    Nov 2009
    Location
    Boston, MA, USA
    Posts
    52
    It would be interesting to take a poll about developer's thoughts on the role of JavaScript and Java Applets, but that isn't the question I am asking. I'd prefer to keep this thread focused on the question as presented.

    Jim

    Quote Originally Posted by sohguanh View Post
    Whenever we do client side coding, we are bounded by the browser rules. If browser allow user the option to turn off Javascript or even Java, basically web-pages with Javascript cannot run and so does Java Applet.

    But at current age and time, I would presume most user will enable Javascript and Java.

    A classic example would be local banks in Singapore all uses Java Applet for the login page, so if you want to do internet banking, you got to install and enable Java isn't it ? I call such design as 'implicitly' forcing users to install and turn on Java.

    I have not found a case where Javascript is strictly needed. Anyone want to give example of how companies/institutions "implicitly" forcing users to turn on Javascript ?

  7. #7
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    javascript can remove and add inputs, and ti can change input attribs, except for type.

    code a version that works without JS, and have you js make whatever mods/additions you need. you can create a whole form in javascript if need be, but it's simpler to just change what you need.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles