Re: Auto-save feature
The idea would be to save the form data as work in progress in a separate storage area. If the user's session times out they would be directed to a page telling them that their session timed out which would give them the option to attempt to resume the work. I was able to bypass validation by setting a flag on the form. Since we use a layer of composite controls on top of the standard wicket controls I was able to tap into the form validation flag in each control to override required fields and validations as required. I understand why turning off the default form processing doesn't apply validations and therefore does not update models, but it would be nice to have a way to override this and just update models. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663549.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Auto-save feature
Well yes, that work in progress might be a mistake. Think of it as getting a lock on a db record for too long. Or worst, not locking at all and then later updating the record. You would override the state without knowing it changed since you last read it. So, if you devise such work in progress you should also be concerned about warning the user that some field's value has been changed by another concurrent user that saved the same form while the first user was still editing the page. What I'm more curious about is, how did you come up against this use-case in the first place? Why is it that your user edits a form for so long that the session times out and its user input is lost? On Wed, Jan 8, 2014 at 9:42 AM, gmparker2000 greg.par...@brovada.comwrote: The idea would be to save the form data as work in progress in a separate storage area. If the user's session times out they would be directed to a page telling them that their session timed out which would give them the option to attempt to resume the work. I was able to bypass validation by setting a flag on the form. Since we use a layer of composite controls on top of the standard wicket controls I was able to tap into the form validation flag in each control to override required fields and validations as required. I understand why turning off the default form processing doesn't apply validations and therefore does not update models, but it would be nice to have a way to override this and just update models. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663549.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Auto-save feature
You can take a look over the Form Porcessing at http://wickettraining.com/ten-things-every-wicket-programmer-should-know.html I'm supprised that the free guide didn't include such an ilustration (or maybe I missed it). Check out also the Default Form Processing of the free Guide: http://wicket.apache.org/guide/guide/single.html#chapter11_1 On Wed, Jan 8, 2014 at 11:32 AM, Paul Bors p...@bors.ws wrote: Well yes, that work in progress might be a mistake. Think of it as getting a lock on a db record for too long. Or worst, not locking at all and then later updating the record. You would override the state without knowing it changed since you last read it. So, if you devise such work in progress you should also be concerned about warning the user that some field's value has been changed by another concurrent user that saved the same form while the first user was still editing the page. What I'm more curious about is, how did you come up against this use-case in the first place? Why is it that your user edits a form for so long that the session times out and its user input is lost? On Wed, Jan 8, 2014 at 9:42 AM, gmparker2000 greg.par...@brovada.comwrote: The idea would be to save the form data as work in progress in a separate storage area. If the user's session times out they would be directed to a page telling them that their session timed out which would give them the option to attempt to resume the work. I was able to bypass validation by setting a flag on the form. Since we use a layer of composite controls on top of the standard wicket controls I was able to tap into the form validation flag in each control to override required fields and validations as required. I understand why turning off the default form processing doesn't apply validations and therefore does not update models, but it would be nice to have a way to override this and just update models. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663549.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Auto-save feature
Its not so much that the user will actively be working on the form that long. Its more a case that users can get distracted for extended periods of time while they are working with our form. If they half finish the data entry, then have to take a few phone calls, it wouldn't be great if they lost everything they were working on. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663559.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Auto-save feature
So how do you solve the problem of two users concurrently editing the same record? You could do something like gMail that saves a draft of your e-mail only that your draft is your model(s) serialized. However, you still need to indicate to the user that some of the fields which have been saved in the draft have been updated. ie: You would need to restore the draft model and compare it against the life one. Perhaps you should do that on an Ajax timer event on the page that would check each 10 secs or so for changes done to the back-end? Boy, I'm glad I don't have to worry about your use-case :) Perhaps you should start a new e-mail thread specific to your use-case instead of auto-save. On Wed, Jan 8, 2014 at 11:43 AM, gmparker2000 greg.par...@brovada.comwrote: Its not so much that the user will actively be working on the form that long. Its more a case that users can get distracted for extended periods of time while they are working with our form. If they half finish the data entry, then have to take a few phone calls, it wouldn't be great if they lost everything they were working on. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663559.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Auto-save feature
I am looking at implementing an auto save feature on a form I have created. This would save the data that the user had entered prior to their session timing out. The form has various validations that would have to be disabled before this could work. I have seen numerous posts around disabling validation based on which button was used to submit the form, etc. However, none of the answers seemed satisfactory. The only thing I can think to do is set a flag on the form that each validator would check to see if it should proceed. This is going to be a lot more work than if I could just call updateFormComponentModels myself (I tried this but it didn't work). -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Auto-save feature
I don't know if that is what you are looking for but there is a JS script that can do it for your. Data are store locally. http://garlicjs.org/ -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663521.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Auto-save feature
Interesting but unfortunately our form is very complex with repeaters, etc. So I don't think this would work for us. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663522.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Auto-save feature
In a similar case I've used a wrapper around validators which controls whether they run or not. This way you can automatically parse the form component tree, find all validators and wrap them in a new Validator that runs them only if needed. I've done this because I wanted to be able to have the standard wicket validators run in onValidateModelObjects(). I.e. I wanted my model to be updated even if some validations did not pass. So here's the basic idea (this is slightly modified from my actual code so it may have small errors). public abstract class ValidatorWrapperT implements IValidatorT { IValidatorT validator; public DelayedValidator(IValidatorT validator) { super(); this.validator = validator; } protected abstract boolean shouldRun(); @Override public void validate(IValidatableT validatable) { if (!shouldRun()) return; if (validatable.getValue() == null) { if (!(validator instanceof INullAcceptingValidator?)) { return; } } validator.validate(validatable); } } It is reasonably easy to extend this for FormValidators as well. This does not handle the case of conversion errors, i.e. in an Integer TextField if the user input is not a valid integer, it won't update the model object. So if you auto-save and the reload, such fields will be empty. This is something that would actually be a lot of work to handle because you would need a custom model that would actually store string values. Cheers Marios On Tue, Jan 7, 2014 at 9:32 PM, gmparker2000 greg.par...@brovada.comwrote: Interesting but unfortunately our form is very complex with repeaters, etc. So I don't think this would work for us. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663522.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Auto-save feature
This is a bizarre use-case to some extent. You want the user's input to be saved prior to the user's session expiring. Wouldn't it be easier to run validation and save the user's input as the field level? This way as the user leaves a form field, the validation kicks in and if correct the new input is saved. Granted you would have to work some other flows, you might want different states of saving the user input. One committed to the storage tier, the other committed to the user's name space as one can navigate through your UI and leave from one page to another. Should you still show the auto-saved form fields which override the actual state of the application? Probably not, so you'll have to reset the auto-saved data each time the page is rendered. Is a cool idea duh, persist the user's input between sessions (although not right as you'll hide the actual state). ie: What happens when it takes me 1 hr to time out my session, I come back tomorrow and see my old input instead of what's really in the database? ~ Thank you, Paul Bors On Tue, Jan 7, 2014 at 2:52 PM, Marios Skounakis msc...@gmail.com wrote: In a similar case I've used a wrapper around validators which controls whether they run or not. This way you can automatically parse the form component tree, find all validators and wrap them in a new Validator that runs them only if needed. I've done this because I wanted to be able to have the standard wicket validators run in onValidateModelObjects(). I.e. I wanted my model to be updated even if some validations did not pass. So here's the basic idea (this is slightly modified from my actual code so it may have small errors). public abstract class ValidatorWrapperT implements IValidatorT { IValidatorT validator; public DelayedValidator(IValidatorT validator) { super(); this.validator = validator; } protected abstract boolean shouldRun(); @Override public void validate(IValidatableT validatable) { if (!shouldRun()) return; if (validatable.getValue() == null) { if (!(validator instanceof INullAcceptingValidator?)) { return; } } validator.validate(validatable); } } It is reasonably easy to extend this for FormValidators as well. This does not handle the case of conversion errors, i.e. in an Integer TextField if the user input is not a valid integer, it won't update the model object. So if you auto-save and the reload, such fields will be empty. This is something that would actually be a lot of work to handle because you would need a custom model that would actually store string values. Cheers Marios On Tue, Jan 7, 2014 at 9:32 PM, gmparker2000 greg.par...@brovada.com wrote: Interesting but unfortunately our form is very complex with repeaters, etc. So I don't think this would work for us. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Auto-save-feature-tp4663517p4663522.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org