Results 1 to 2 of 2
Thread: Audit input
Dec 20, 2012, 09:47 #1
- Join Date
- Dec 2012
- 0 Post(s)
- 0 Thread(s)
I have a question on a web page asking yes or no be checked. How do I insure the user checks yes or no?
Dec 20, 2012, 14:48 #2
- Join Date
- Aug 2007
- 50 Post(s)
- 2 Thread(s)
Well, you can't force anyone to do anything. But you can hint strongly :P
So an annoying alert() popup is one option (to remind people... first time they click, their action is cancelled and they get a popup. Next time they click, they get through. Or be really evil and keep giving them popups until they make a choice).
If this is a form, or a gateway page to more pages, you can use the form. Whatever users are clicking to get to your next page, you can prevent access to your next page with form validation.
<p>Please choose yes or no before preceding to the next page:</p> <form action="nexturlpeoplewanttogoto" method="get"> <fieldset> <input type="checkbox" id="yes" name="yes" value="1"><label for="yes"> Yes</label><br> <input type="checkbox" id="no" name="no" value="2"><label for="no"> No</label> <input type="submit" value="To The Next Page!"> </fieldset> </form>
or you can change to POST and have the backend either
-send out a validation error on the same page, or
-send the user a url to the next page (let them pass through)
There are other ways (evil back-button-breaking new target/iframes for example) but these are the first ones that come to my mind. It kinda depends on why users must choose one of these things.
None of the above techniques would prevent a user from just leaving your site or going anywhere else. This only really works when both the page they are on and the page they want to go to are both yours.