Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefilling with Localstorage-Values is messing with "real" content in forms #27

Open
koernchen02 opened this issue Jun 5, 2014 · 2 comments

Comments

@koernchen02
Copy link

I have an php-based Application, where a user can create and edit posts.
When I edit any post and submit the form, the Localstorage does not get flushed automatically, which prefills the textarea marked with data-widearea= true" whenever I edit another post. Of course, the Text coming from the localstorage is not the correct content when I edit another post/record, since it is the textareas content coming from the "last-edited" post.

Would it be possible to automatically call wideArea().clearData() whenever a form is submitted?

I know this is kind of an individual problem, but I can Imagine a lot of people are using wideare.js in contexts, where editing Records via the same form-templates is a normal workflow…

I'm sticking to v0.2 for now… just wanted to let you know!

Best regards and thanks for your great js-libraries!

@Thyrosis
Copy link

Thyrosis commented Oct 6, 2015

I know this is an old post, but I started using WideArea yesterday and - although I love the simplicity and functionality! - the issue Koernchen02 describes does still exist. The local storage isn't cleared on form submission, which means that the first time one calls wideArea() it takes the content of the text area and saves it into the storage, and it will persist there.

Now, the funny thing is, calling wideArea().clearData(1) doesn't only clear the local storage, but also the content of the text area! I figured that, on pressing the submit button, I could call the clearData function, but that way my $_POST array turns up an empty text area content.

The solution to this is editing the widearea.js file slightly.
Line 99: currentElement.value = '';
Comment this line out. It keeps the text area content intact but will still clear the local storage (on line 100).

Hope that saves someone else a lot of searching!

@rrickgauer
Copy link

Unfortunately this does not fix the issue. Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants