Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

How to restrict user marking same events in multiple times.

 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In my online exam system, I am displaying the questions and related answer in jsp page. Once user fill all this questions, the result of these stored in final table containing column questonNo, userid, answer, testname.
Now in my application if any user goes back to the question displaying page after submitting same questions, he can change the answer selected in first attempt and submitting again the test, the result are stored in final table. I.e. for same question no. user is now able to answer in two times. I want to restrict user for answering test in second times.
How can I achieve this?
Any suggestion is highly appreciated?
Thanks and Regards
Harshal
 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can make the question number and the userid as a composite primary key in the database table. Before inserting the data into the table, check whether a row already exists in the table. If it already exists, do not allow another insert, rather allow an update.
 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sripathi,
Thanks for your reply.
Can i use javascript function disabled with my form so that restructuring of thr database will be avoided.
Thanks and regards
Harshal
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using Javascript, you can take care of the back button, but the user will still be able to re-answer using the reload button and refreshing the page.

So I think the server must take care of this.


Hope this helps
 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi amit,
Thank you for your valuable help.Thus Sripathi idea is the best ways to to solve this problem. As i had done lot of work with my current database structure ,changing database structure will couse some trouble in application.
Whether you have any other idea?
Thanks and Regards
Harshal
[ August 20, 2008: Message edited by: Harshal Gurav ]
 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can anyone have solution for above issue?

Any help is highly appreciated.
Thanks and Regards
Harshal
 
Amit Ghorpade
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about maintaining flags for marked questions and storing them in the session complemented with Javascript on the client side.
Thats the only think on my mind now.

Hope this helps
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
have a look at javascript, window.history.forward(1);

add this in the head of your next page and the user cannot go back to that page.
 
Sheriff
Posts: 67671
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Danny Carson:
add this in the head of your next page and the user cannot go back to that page.


Very non-user-friendly, and not a tactic that serious web developers should employ. Rather, use good patterns on the server to make sure that the web application behaves well rather than hobbling the user's browser.
 
Bear Bibeault
Sheriff
Posts: 67671
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. You may find this this recent related post helpful.
 
Danny Carson
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:

Very non-user-friendly, and not a tactic that serious web developers should employ. Rather, use good patterns on the server to make sure that the web application behaves well rather than hobbling the user's browser.



I dont see it as much of a problem if the developer has a good navigation tool on each page. If the user wants to go back to that page then they click the menu item. Thats my opinion anyway.
 
Marshal
Posts: 27375
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Danny Carson:
I dont see it as much of a problem if the developer has a good navigation tool on each page. If the user wants to go back to that page then they click the menu item. Thats my opinion anyway.

It's not my opinion. I've used applications that don't let you go back. Quite often I'm done with looking at that application and I want to go back to where I was earlier. Usually the Google search page where I found the link to the application. It's extremely annoying if I can't do that.
 
Danny Carson
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
It's not my opinion. I've used applications that don't let you go back. Quite often I'm done with looking at that application and I want to go back to where I was earlier. Usually the Google search page where I found the link to the application. It's extremely annoying if I can't do that.



Yes on second thoughts I agree. I was looking at it from an internal web app point of view.
 
Paul Clapham
Marshal
Posts: 27375
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Danny Carson:
Yes on second thoughts I agree. I was looking at it from an internal web app point of view.

Exactly! I think you'll find that everybody else who wants to do these "stupid browser tricks" is looking at it from that point of view too.
 
Bear Bibeault
Sheriff
Posts: 67671
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a really good point, Danny.

I think there are a lot of web developers who tend to think that the browser is theirs to do with as they please. This is evidenced by the number of questions like "How do I change the browser settings from my site?", "How do I close the browser when the user logs off?", "How do I disable the refresh and back button?" and so on.

All of these indicate a myopia regarding what a well-behaved web application should do. This has been captured in this FAQ entry.
 
Danny Carson
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keep up the good work guys!
You're doing your part to educate the inexperienced developers.

Cracking Forum by the way.

DC
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic