Derek, that bit where you mention hooking "run-time" validation to be saved, is pretty much what I’m doing in my post. You need to consider that you might not have a complete record to insert, but one field at the time, hence why I create the ‘updateTableService()’. From what I understand, the only difference between what you suggest and what I did, is that on my code, the validation is fully done on the server side. The advantages are that I can apply validators such as ‘isUnique’ (among others that require the DB access) as well enforce input validation (from a security standpoint, there is no such thing as client-side input validation). The downside is obviously performance whenever things don’t even need to reach the server-side and parsley is able to do them immediately within the browser.
I guess I could add parsley to get the best of both worlds... Thank you, Francisco On 7 Jul 2014, at 22:07, Derek <sp1d...@gmail.com> wrote: > If you read, I suggested that when the 'page close' or 'navigate away' event > is fired, you can trigger a save then (one option). You can use parsely to > manage your validators (because you don't want to save invalid data). It will > do run-time validation, which you can then hook into to do the saving for > you, so as soon as valid data is entered, it is saved. > > Another option is to collect a small amount of information at a time. Such > like a 'wizard' interface. Take a look here for what I'm talking about: > > http://parsleyjs.org/doc/examples/multisteps.html > > > On Friday, June 13, 2014 3:29:20 PM UTC-7, Francisco Ribeiro wrote: > Thank you for stepping up to reply but 'parsely' looks more like a library > for client-side form validation which is not really the major problem I am > trying to address. My goal is to have a mechanism that stores (with > persistence) information provided by the user as soon as possible once it is > provided input field by input field (on focusOut event) , rather than just > doing all at once when the form is submitted. Anyway, thanks :) > > Francisco > > > On Friday, 13 June 2014 21:06:48 UTC+1, Derek wrote: > Try 'parsely' > > http://parsleyjs.org/doc/examples/simple.html > > and prompt on page close to save first. > > On Wednesday, June 11, 2014 7:43:41 PM UTC-7, Francisco G. T. Ribeiro wrote: > hi all, > I'm working on an app that uses forms that can be quite long and its users > often interrupt their sessions for whatever reason and end up losing the > information already filled. For this and other reasons I wanted to provide a > different behaviour to these forms where each input field updates the record > on the database as soon as its input field is released ('focusOut' event on > jQuery). Ideally, the server would reply with 'success' or an error message > so users know when they can move on to another field (without refreshing the > whole page). By the end of the form, the user wouldn't have to review things > that were written long ago since these were all already validated. > > Now, I know this can be tricky due to database constrains but because i need > to do this very often (multiple fields and multiple forms), I thought it > would be useful to automate it, maybe even by having on the db Field > something like '..auto_update=True' (merely a suggestion) but before getting > there, I would like to know if anyone has faced this problem and if yes what > solution did you employ? > > Thank you in advance, > Francisco > > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the Google > Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/v1MD3u5ZLm0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Message signed with OpenPGP using GPGMail