Announcement

Collapse
No announcement yet.

Event handling and cancel the action

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

  • Event handling and cancel the action

    Hello;
    I would like to know if the php code that I put inside the event such as onAfterUpdate or onBeforeUpdate is executed using ajax or php itself(reloading the page) ?
    and How can I cancel the action after doing some checking and find that the condition for processing is not well Ex: the user wanna update a record and I do some checking in onBeforeUpdate and wanna cancel the update that the user wanted to do by poping up a message using javascript.

  • #2
    Originally posted by magezi View Post
    Hello;
    I would like to know if the php code that I put inside the event such as onAfterUpdate or onBeforeUpdate is executed using ajax or php itself(reloading the page) ?
    and How can I cancel the action after doing some checking and find that the condition for processing is not well Ex: the user wanna update a record and I do some checking in onBeforeUpdate and wanna cancel the update that the user wanted to do by poping up a message using javascript.
    You put all such logic checks in onvalidate. For each failed condition, use sc_error_message and sc_errror_exit macros (boiler plate code for these are available in the right hand panel). That way control does not flow to update/insert at all.

    Comment


    • #3
      Originally posted by scriptcaser View Post
      You put all such logic checks in onvalidate. For each failed condition, use sc_error_message and sc_errror_exit macros (boiler plate code for these are available in the right hand panel). That way control does not flow to update/insert at all.
      Thanks!!!! I understand I think for being specific I have to use onbeforeupdate,onbeforeinsert...because they let me know wich button exactly was clicked but validate is not clear

      Comment


      • #4
        Your salvation is still in onvalidate methinks: http://www.scriptcase.net/docs/en_us...iptcase-macros. Scroll to sc_button_update.

        Comment


        • #5
          Originally posted by scriptcaser View Post
          Your salvation is still in onvalidate methinks: http://www.scriptcase.net/docs/en_us...iptcase-macros. Scroll to sc_button_update.
          It's ok if the control that I'll do in that even will be done before the data to be submitted(inserted or updated or deleted) in the Database and gives me as you explain above the option to cancel the operation if the check returns failure.

          and can that macro work for multiple records form application?

          Comment


          • #6
            Originally posted by magezi View Post
            and can that macro work for multiple records form application?
            Since the documentation says it's available in onvalidate, I would assume so. I think for multiple recs it shows all the errors (applicable to all failed records) at once. But don't quote me. :-)

            Comment

            Working...
            X