Announcement

Collapse
No announcement yet.

Automatic saving

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic saving

    Does anyone knows how to do an automatic save on a form when navigating from record to records ?
    I just don't want my user to click the save button and after that, click the next button.

    Thanks

    Sylvain

  • #2
    Originally posted by sdanigo View Post
    Does anyone knows how to do an automatic save on a form when navigating from record to records ?
    I just don't want my user to click the save button and after that, click the next button.

    Thanks

    Sylvain
    If you have a logical flow of forms then set a sc_redir in the onafterinsert button. Don't forget to start the procedure with a sc_commit_trans(); Then after save you will jump to the next form automatically.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Hi,
      well, my form display record by record some data.
      These data are pre-populated, so my form is not in insert mode, but always in edit mode (you can only change value in the form, not add a new record).
      I navigate between records using the buttons in the tool bar (prev, next,...).
      My goal is to save the form just before leaving it when a user click the next button for instance (I don't want him to have to click the save button then the next button).
      Is there a way to do that ?

      Thanks

      Sylvain

      Comment


      • #4
        the only solution would be to use an ajax onchange event with an update sentence... but i have to tell you that your application performance will decrease a lot

        Comment


        • #5
          Hi,
          I'm quite sure it could be easy.

          I can use that piece of code to update the whole form

          // Javascript function parameters
          $javascript_function = 'nm_atualiza';
          $javascript_parameters = array( 'alterar');
          // Call javascript function
          sc_ajax_javascript($javascript_function, $javascript_parameters);
          I've tried to put that in some events (onNavigate for instance) but it doesn't work (I think that the onNavigate is triggered to late, we have already quit the form).

          If someone has an idea, it would be greatly appreciated.

          Thanks

          Sylvain

          Comment


          • #6
            The best would be to create your own javascript buttons (first_rec,prev_rec,next_rec, last_rec).

            Button code (next_rec):

            Code:
            nm_atualiza('alterar');
            setTimeout(function() {nm_move('avanca');},1000); //you need a delay (1000 = 1s) here to wait for the update to finish, otherwise the form would lock up. You might need to adjust the time. Just try what works best for your system.
            Parameters for nm_move():
            first = 'inicio'
            previous = 'retorna'
            next = 'avanca'
            last = 'final'

            jsb

            Comment


            • #7
              Hi,
              thanks,
              that works perfectly :-)

              Comment

              Working...
              X