Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lock all records if all questions answered

Status
Not open for further replies.

evr72

MIS
Dec 8, 2009
265
US
Hello,

I am trying to lock all questions for each user if all the questions have been answered, I can easily do this in each question, but not sure how to go about and do it for all the questions. The issue is that I have several sections of questions.
Here is what I am using to lock each question answered.
Code:
if data("Status")="Yes" then 

   record("edit_link")=false 

end if
this hides my edit button. I also have a field that identifies if this is the last question so I was thinking in doing something like this
Code:
if data("Status")="Yes" and data("onoff")="Yes"then 

   record("edit_link")=false 

end if
But silly me this would only work if both fields are "Yes" and "Yes" in the same row.
here is where I am not sure how to go about this.

any help is as always much appreciated.

Thanks in advance!!!
 
You are starting in the middle and telling us only part of what is going on, so it is a litle difficult to answer any questions.

If you have some sort of quiz and you are making some sort of server call to check an answer triggered by some sort of action in the client, then "this would only work if both fields are "Yes" and "Yes" in the same row" seems nonsensical. If you are going to the server you can check whatever you want.

I'm sorry, but I really can't make heads or tails of this.
 
Sorry for my poor explanation.

BigRed1212, This is a questionaire, that different companies, each company has a cycle and a functional area, a person in each company could be part of a cycle and different functional areas,
so I was asked to write a lock for each complete functional area.
for example
we have a cyele = Accounting and two functional areas Receivables and Payables
in this case there is one user for each functional area,
so if the user for Receivables is finished with his questions I have a field called "lastquestion" this gets checked by the administrator, so if the last question is equal to "Yes" the user gets redirected to another page.
What I am trying to do is prevent the user from making any changes to the answered questions after the last question is filled out.
It it a bit complicated and honestly I don't think I am doing a good job explaining it.
 
It's okay. Sometimes its tough to explain stuff.

If the idea is to lock a group of questions once they have been answered, then I would want to have that done by my application and not be dependent on my administrator or me having to spot it. I also wouldn't want a designated "lastquestion" trigger as I always assume users never do what you expect and would likely answer questions out of order or skip things given half a chance.

So say you have a form with questions.
Presumeably what happens is Fred or Joe or Susan answers a question and his/her response is inserted into your database.
What I would be tempted to try (and it would take me awhile to figure out) would be to execute the SQL for the insert on each question answer action (button click, onChange, whatever) and then after executing that SQL, execute a second piece of SQL that checked to see if all the questions in that question group I was interested in and to which the current question belonged were answered (not null). If they weren't, nothing happens. If they are, I would want to open some sort of over the top user confirmation box that says "This section is done, right?" with a user yes or no choice. The user yes response then would give me the chance to freeze all that section out. Maybe rewrite the presentation so that all the answers were just displayed next to the questions or something.

I would want a quiz-like thing like this to be done with AJAX which is what would slow me up. I could do the question and answer call and response AJAX style to provide immediate user feedback on a particular question/answer, but exactly how I would get the "complete" box to trigger (especially since I would want to use a flashy client side javascript effect) would take some effort and thought.

If it was all to be traditional form POST and reload the response page, it might be easier.

Keep talking and brainstorming and if I don't help you maybe our discussion will trigger somebody much smarter to jump in with the answer.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top