js requirement

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
reecec
Forum Contributor
Posts: 218
Joined: Sun Apr 02, 2006 7:12 am

js requirement

Post by reecec »

hi

Sorry as this isnt really about php but from experience as coders do you think it would be a problem to say they cant use it unless javascript is enabled or will i have to do all the pages again for people who dont have javascript for the confirmations of deleteing

thanks reece
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

Well, the answer to that question depends on a lot of factors.
- Do you have users who are not able to use javascript (using alternative devices, mobile phone, old browser?)
- Do you have users who don't want to have javascript enabled (maybe a few % of regular webusers)
- Is the application openly accessible? yes? Then you will have "users" who disable/ignore javascript to try and mess with your system

The answer to the first 2 questions should tell you if it's a good idea to make javascript a requirement. in other words, who is your audience?
The answer to the last question is more related to security issues related to your app.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Generally I design a page without javascript. Then once this is done I enhance it with javascript if appropriate. You then have a site which will work for most people but with an enhanced experience for those with javascript.

I do not use javascript for alerts/confirmations etc as I normally find them ugly (i know you can snazz them up but in my opinion it is not worth the effort).

As has already been mentioned in one post (not sure which though) the main problem is not catering for people not having javascript switched on, but those people who do not have access to it (due to using a screenreader etc for "accessibility"). I personally think very few people switch javascript off. I have heard figures like 10% but in my experience this is not the case.
reecec
Forum Contributor
Posts: 218
Joined: Sun Apr 02, 2006 7:12 am

Post by reecec »

Thanks.
my script will not be open, it will be only for registered paied users. It will just be used on the a pc not mobile.


The js will only be used for confirming delete which is not a problem if js is turned of it will just not delete.


It is a pain to make the confirmation in a seperate php file as i have to keep carry the variables through hiding them in forms and stuff does anyone area that its more simple just to use js for promting


thanks reece
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

There are alternatives to passing the delete list...
Have you thought of using storing the delete list in a session ?
The processing of the delete list doesn't have to be in a separate file. You just need to check if $_POST['confirm_del'] is set.
reecec
Forum Contributor
Posts: 218
Joined: Sun Apr 02, 2006 7:12 am

Post by reecec »

yes i supose i could do it alot easyer then i may have been doing

but would i still use a seperate file

choose delete -> check -> drop

thanks reece
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You can uses phases within the same PHP script. Step 1, step 2, etc. I personally think it is a bad idea to rely on javascripting for anything that is critical to the operation of your application. If it is used to make things fancy, the all the better, but when you are using it for validation, confirmation, restriction, then you are asking for trouble.
Post Reply