PDA

View Full Version : Is there anyway to restrict users from filling out forms who have Java disabled?


woofy
06-20-2011, 06:22 AM
Is there anyway to restrict my users from filling out forms who have Java disabled? I have a form that works fine by limiting users who don't have enough credits from downloading restricted files to be inserted into their user profile. But all they need to do to get the file to be inserted into their database is disable javascript and the java script check form function won't work and they will be able to gain access to restricted files which are inserted into their database. I need to have it locked down to prevent this. A method which would prevent them from viewing that specific page if java script was disabled would be ideal. Any suggestions?

Corrosive
06-20-2011, 06:47 AM
Depends what you want to do when js is disabled but you can use a <noscript> tag to handle this. Example;

<noscript>
<meta http-equiv="refresh" content="0;url=http://www.google.com" />
</noscript>


This will redirect to google home page but you could do something else, redirect to another page on your site or maybe hide the form.

m1a2x3x7
06-20-2011, 05:37 PM
Here's what I would do...

1. The div that contains for form, have it set to display none with CSS.
2. Have another div that is shown and says "You must have JavaScript enabled to view this form."
3. Use JavaScript to change the div that holds the form to display:block and hide the div with the no JavaScript message.

If the form displays then the user has JavaScript enabled. If the form doesn't display then they don't have it enabled and the message tells them to enable it.

If you need help writing it, let me know. I can whip something up for ya.

-M