jweisbeck / Crossword

A javascript crossword puzzle script
http://www.jesseweisbeck.com/crossword/
244 stars 140 forks source link

How to save input actions? #17

Open JamshidTashpulatov opened 5 years ago

JamshidTashpulatov commented 5 years ago

How can I save the data entered in this game while playing the game LocalStorage ? To prevent the data entered from being updated while the page is up.

bradzo commented 3 years ago

Hi @JamshidTashpulatov

That's something I'm working on right now. Did you manage to get that sorted out?

Cheers Brad

bradzo commented 3 years ago

Hi @JamshidTashpulatov

See my post re "show stored puzzle attempts" - that may give you a clue. :)

vidyeshranade commented 2 years ago

Hello Brad,

How to save the answer entered by user into attempts key?

best regards, Vidyesh

bradzo commented 2 years ago

Hello Brad,

How to save the answer entered by user into attempts key?

best regards, Vidyesh

Hi Vidyesh

Unless I've misunderstood your question...

Since the attempt key is simply part of the JSON data for each crossword entry (if you've followed what I posted at https://github.com/jweisbeck/Crossword/issues/23) then you can use whatever storage mechanism you like - Mongo, Localstorage, anything really. Up to you when you save it, depending on your solution, localStorage would probably be fastest as they enter each letter. And to then continue a puzzle, get the puzzle data from whatever your storage is and invoke my showAttempts function in puzzInit.

Cheers Brad

vidyeshranade commented 2 years ago

Hello Brad,

Thanks for a warm reply. I did the same as you suggested (using localStorage, simple and quick approach). It is now able to retrieve the correct answers of earlier visited puzzles.

I'll share my crossword link once I deploy on heroku. I liked your showAttempt solution.

best regards,Vidyesh Ranade+91 9850 88 91 88

On Fri, May 27, 2022 at 11:43 AM bradzo @.***> wrote:

Hello Brad,

How to save the answer entered by user into attempts key?

best regards, Vidyesh

Hi Vidyesh

Unless I've misunderstood your question...

Since the attempt key is simply part of the JSON data for each crossword entry (if you've followed what I posted at #23 https://github.com/jweisbeck/Crossword/issues/23) then you can use whatever storage mechanism you like - Mongo, Localstorage, anything really. Up to you when you save it, depending on your solution, localStorage would probably be fastest as they enter each letter. And to then continue a puzzle, get the puzzle data from whatever your storage is and invoke my showAttempts function in puzzInit.

Cheers Brad

— Reply to this email directly, view it on GitHub https://github.com/jweisbeck/Crossword/issues/17#issuecomment-1139315963, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXPESPTJJBICQJGRJ3IUCDVMBRZ7ANCNFSM4G3XLNUA . You are receiving this because you are subscribed to this thread.Message ID: @.***>