Author Topic: An interesting problem I'm SURE someone can solve (not me!)  (Read 7202 times)

comp1921

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
An interesting problem I'm SURE someone can solve (not me!)
« on: April 24, 2004, 11:05:17 PM »
I have a bunch of questions I ask visitors.

Depending on their answer to one question, different NEXT questions are asked...so each user's set of questions could be unique.

The problem is this...
say that a user answers 5 of 20 questions, then while in the middle of answering question 5, they click a hyperlink on the page and leave the question-page. if they then go back to the question-page, I need to keep track of what they had been typing for question 5 before they had left.

But when they do return to question 5, all their text in the form inputs is erased. How should I best keep it?

Please email me any help you can offer...I'm sure someone has come across this problem and can solve it! So many intelligent people here....

Thanks
Jason
comp1921@telus.net

Tarential

  • Regular Member
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #1 on: April 25, 2004, 05:06:27 AM »
Actually, that is ... basically, not able to be solved. Unless maybe you had javascript code that redirected the page to a script that stored your variables as session vars, then redirected them back to the page they clicked on. That would be a lot of work to code, however, and probably wouldn't work half the time anyway. What it boils down to is one key point:

If your users are stupid enough to partially fill out a form and then click on a hyperlink to go somewhere else, they deserve to have their information lost.

Now, if you are talking about storing the information that has already been submitted to you for the next time the user goes to the questions, *that* is simple. First decide if you need it to be stored when the user goes offline or not. If not, just store everything as session variables. If yes, set a cookie, and store the information in a database or a text file.
"I did not sleep with those medals... er, throw away those weapons of mass destruction... I mean ribbons... what was the question again?" - US Presidents 101
------
Disclaimer: Don't bother messaging me about this. You'll just start a flame war.

drewbee

  • Regular Member
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #2 on: April 25, 2004, 07:59:57 AM »
Tarential... I've seen this done on websites before, but it is done through javascript/php or asp as the case seems fit. You can browse through different pages (clicking on a hyperlink) and any new information you change is automatically remembered. The actual submit button finally updates the database, but their are about 10 pages of other information that you can edit/update before actually saving it. Not sure how this was done though... maybe setting cookies with javascript? If I remember corectly in javascript their is a way to tell when the mouse/curser leaves a text box, and when this happens is when it executes and "remembers"...

Ideas? Obviously I am no expert, just a suggestion.

What do you think? Can It Be Done?
Rather then be like most men who want the world to know them; I want to know the world.

Tarential

  • Regular Member
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #3 on: April 25, 2004, 08:58:08 AM »
Oh, wait... you mean, what I just said?
"I did not sleep with those medals... er, throw away those weapons of mass destruction... I mean ribbons... what was the question again?" - US Presidents 101
------
Disclaimer: Don't bother messaging me about this. You'll just start a flame war.

comp1921

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #4 on: April 25, 2004, 02:46:02 PM »
drewbee, i think you have something there, when the textbox loses focus, save a cookie or something

gracias!

Tarential

  • Regular Member
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #5 on: April 25, 2004, 06:51:41 PM »
Quote from: "Tarential"
If yes, set a cookie, and store the information in a database or a text file.


Couldn't be that I already said that... no... did neither of you read my post?
"I did not sleep with those medals... er, throw away those weapons of mass destruction... I mean ribbons... what was the question again?" - US Presidents 101
------
Disclaimer: Don't bother messaging me about this. You'll just start a flame war.

drewbee

  • Regular Member
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #6 on: April 25, 2004, 11:36:18 PM »
eh I did, lol sorry bout that. Something about the way you worded it maybe?
Rather then be like most men who want the world to know them; I want to know the world.

Tarential

  • Regular Member
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #7 on: April 26, 2004, 10:14:51 AM »
"If yes, set a cookie" seems pretty straightforward to me. I don't know where you are from or what language you speak natively, but I doubt there is anyone here who doesn't understand that.
"I did not sleep with those medals... er, throw away those weapons of mass destruction... I mean ribbons... what was the question again?" - US Presidents 101
------
Disclaimer: Don't bother messaging me about this. You'll just start a flame war.

drewbee

  • Regular Member
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #8 on: April 26, 2004, 04:21:54 PM »
Ok first, calm the attitude... do you enjoy going around these forums and fighting with people or what?

2nd I was reading it through rather quickly, hence why I didn't pick up on it. He missed it too, so I must not be the only one.

Alot of times, and I mean this in the best possible way, I skip over and fail to read posts you have made as I dislike how your "style" is of communicating on the boards. Very cocky I think. But as Is, it was a simple mistake, or are we Mr. Perfect over their as well too?

I do find you to be very inteligent, but maybe the way you present yourself needs some work.
Rather then be like most men who want the world to know them; I want to know the world.

Tarential

  • Regular Member
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #9 on: April 26, 2004, 04:34:40 PM »
And you speak of not liking my attitude? I haven't been insulting you. Perhaps you should show the same courtesy.

Forgive me for getting to the point and not coddling people uselessly. Programming is NOT EASY, for the most part. It can be, of course, but most easy stuff isn't useful, and is just something we must do to get to the good parts. However, if someone cannot do the easy, menial part, and do it well, their future scripts are going to fail. I know what other instance you speak of, and he should have grabbed that error a hundred times over before posting it to the forums. You know it. I answered hard so that he learns to problem solve for himself. You think he'll just come back here next time he has a stupid problem? No! He'll research it first, just as all the mods here and the FAQs advise you to do. To be a good programmer, you must be able to learn for yourself. You must know that. If you feel like posting a huge reply to people like him every time they have a small problem, then by all means do it! Don't let me get in your way. I'm not taking away your right to answer. I gave him help, and thats more than you gave him.

[/rant]
"I did not sleep with those medals... er, throw away those weapons of mass destruction... I mean ribbons... what was the question again?" - US Presidents 101
------
Disclaimer: Don't bother messaging me about this. You'll just start a flame war.

ManiacalV

  • Regular Member
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #10 on: April 27, 2004, 02:34:41 PM »
Not to get into the middle of a flame war, but there's a difference between asking a kid to lookup a word in the dictionary and scaring the bejeezus out of him so he never cares about words. I know when I was first learning I had some problems with concepts that I find are easy now, and it's pretty easy to forget how difficult any new language can be. Giving someone enough information to help them without writing their code is not always easy. You both tried to help. But, like people here love to tell those looking for script advice or a paid coder, "You're in the wrong place." This isn't the place for an ego contest or insult-slinging flame war. I'm sure some Yahoo groups would love to hear it, but most people here just want a little coding help...


If those links on your page are editable, why not just have them open in a _blank window so that you don't lose them from your site at all? Maybe even write a script that reads the link if it's external and adds the target automatically (look at the Dialectizer)

comp1921

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #11 on: April 27, 2004, 07:22:36 PM »
ManiacalV, very simple solution, i like it!

Tarential seems like he's got self-esteem issues.

any decent coder will try to make the most efficient use of their time, in this case the most efficient was to find people who have already solved this problem, rather than recreating the wheel

I guess tarential wasn't bright enough to see maniacalv's solution!

cheers.

Tarential

  • Regular Member
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #12 on: April 27, 2004, 10:10:24 PM »
This coming from someone who has 3 posts here and doesn't know me from Adam. Cheers, dumbass.
"I did not sleep with those medals... er, throw away those weapons of mass destruction... I mean ribbons... what was the question again?" - US Presidents 101
------
Disclaimer: Don't bother messaging me about this. You'll just start a flame war.

lig

  • Senior Member
  • ****
  • Posts: 416
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #13 on: April 29, 2004, 06:48:50 PM »
Let me know when we are done being angry - It solves nothing. My apologies comp1921 for you getting caught in the middle of a pissing contest (though you did not need to throw fuel on the fire).
Life is a game... So have fun.
---
PHP Support Forum
#phpc on freenode
Open Source, Open Community

Tarential

  • Regular Member
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #14 on: April 29, 2004, 09:16:37 PM »
We'll be done being angry when I'm through being insulted with no basis of thought.
"I did not sleep with those medals... er, throw away those weapons of mass destruction... I mean ribbons... what was the question again?" - US Presidents 101
------
Disclaimer: Don't bother messaging me about this. You'll just start a flame war.