Confirm dialog box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tomislav

    Confirm dialog box

    Hello,

    I need a method to create Dialog box in PHP to confirm an action like
    for instance, sending an e-mail, so if "OK" is clicked action is
    performed and if "Cancel" is clicked action is canceled.

    I found some examples that are implementing "javascript:ret urn
    confirm()" function in "onSubmit" event of a form but none of such
    methods is functioning (?).

    Is there any way to do this in PHP ?

    Thanks,

    Tomislav
  • Jerry Stuckle

    #2
    Re: Confirm dialog box

    Tomislav wrote:
    Hello,
    >
    I need a method to create Dialog box in PHP to confirm an action like
    for instance, sending an e-mail, so if "OK" is clicked action is
    performed and if "Cancel" is clicked action is canceled.
    >
    I found some examples that are implementing "javascript:ret urn
    confirm()" function in "onSubmit" event of a form but none of such
    methods is functioning (?).
    >
    Is there any way to do this in PHP ?
    >
    Thanks,
    >
    Tomislav
    Not really. You can't open new windows in PHP.

    Your best bet is javascript - it works, just ensure you have javascript
    enabled. Or you can take them to a new "confirm" window. If they
    confirm then continue. If they do not, return to the previous page.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Tomislav

      #3
      Re: Confirm dialog box

      Your best bet is javascript - it works, just ensure you have javascript
      enabled. Or you can take them to a new "confirm" window. If they
      confirm then continue. If they do not, return to the previous page.
      Thank you for your quick response. Below is code snippet I use as
      template to construct my own JavaScript code.

      **

      <form method="post" action="mail.ph p" onSubmit="javas cript:return
      confirm('Do you really want to send this order ?);">

      **

      When I include Submit button in this form form action should be
      performed, e.g. "mail.php" should be executed. Only thing is that it is
      executed directly without any confirm windows.

      JS is enabled and browser is Firefox 2.0. What is more I frequently use
      JS in my designs and this very site I am working on now has plenty of JS
      included. That is a bit confusing - that code above does not work.

      Did I miss something when I incorporated JS in form ?

      Thanks,

      Tomislav

      Comment

      • Jerry Stuckle

        #4
        Re: Confirm dialog box

        Tomislav wrote:
        >
        >Your best bet is javascript - it works, just ensure you have
        >javascript enabled. Or you can take them to a new "confirm" window.
        >If they confirm then continue. If they do not, return to the previous
        >page.
        >
        Thank you for your quick response. Below is code snippet I use as
        template to construct my own JavaScript code.
        >
        **
        >
        <form method="post" action="mail.ph p" onSubmit="javas cript:return
        confirm('Do you really want to send this order ?);">
        >
        **
        >
        When I include Submit button in this form form action should be
        performed, e.g. "mail.php" should be executed. Only thing is that it is
        executed directly without any confirm windows.
        >
        JS is enabled and browser is Firefox 2.0. What is more I frequently use
        JS in my designs and this very site I am working on now has plenty of JS
        included. That is a bit confusing - that code above does not work.
        >
        Did I miss something when I incorporated JS in form ?
        >
        Thanks,
        >
        Tomislav
        Sorry, I don't know - I'm not that great on javascript. Try
        comp.lang.javas cript for javascript questions.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Bas Cost Budde

          #5
          Re: Confirm dialog box

          I usually catch the submit action from the submit button. Would you care
          to see what that gives? The event procedure must cancel the default
          action, cross-browser... let me look this one up... nah, return false
          will do.

          Does that help enough?

          Yow, now I re-read your snippet, something strikes me: inside the inline
          onsubmit definition, there is no need to put 'javascript:'. Maybe that
          is all it takes.

          Uit het bericht van Jerry Stuckle:
          Tomislav wrote:
          >>
          >>Your best bet is javascript - it works, just ensure you have
          >>javascript enabled. Or you can take them to a new "confirm" window.
          >>If they confirm then continue. If they do not, return to the
          >>previous page.
          >>
          >Thank you for your quick response. Below is code snippet I use as
          >template to construct my own JavaScript code.
          >>
          >**
          >>
          ><form method="post" action="mail.ph p" onSubmit="javas cript:return
          >confirm('Do you really want to send this order ?);">
          >>
          >**
          >>
          >When I include Submit button in this form form action should be
          >performed, e.g. "mail.php" should be executed. Only thing is that it
          >is executed directly without any confirm windows.
          >>
          >JS is enabled and browser is Firefox 2.0. What is more I frequently
          >use JS in my designs and this very site I am working on now has plenty
          >of JS included. That is a bit confusing - that code above does not work.
          >>
          >Did I miss something when I incorporated JS in form ?
          >>
          >Thanks,
          >>
          >Tomislav
          >
          Sorry, I don't know - I'm not that great on javascript. Try
          comp.lang.javas cript for javascript questions.
          >

          Comment

          • Jerry Stuckle

            #6
            Re: Confirm dialog box

            Bas Cost Budde wrote:
            Uit het bericht van Jerry Stuckle:
            >Tomislav wrote:
            >>>
            >>>Your best bet is javascript - it works, just ensure you have
            >>>javascript enabled. Or you can take them to a new "confirm"
            >>>window. If they confirm then continue. If they do not, return to
            >>>the previous page.
            >>>
            >>Thank you for your quick response. Below is code snippet I use as
            >>template to construct my own JavaScript code.
            >>>
            >>**
            >>>
            >><form method="post" action="mail.ph p" onSubmit="javas cript:return
            >>confirm('Do you really want to send this order ?);">
            >>>
            >>**
            >>>
            >>When I include Submit button in this form form action should be
            >>performed, e.g. "mail.php" should be executed. Only thing is that it
            >>is executed directly without any confirm windows.
            >>>
            >>JS is enabled and browser is Firefox 2.0. What is more I frequently
            >>use JS in my designs and this very site I am working on now has
            >>plenty of JS included. That is a bit confusing - that code above does
            >>not work.
            >>>
            >>Did I miss something when I incorporated JS in form ?
            >>>
            >>Thanks,
            >>>
            >>Tomislav
            >>
            >Sorry, I don't know - I'm not that great on javascript. Try
            >comp.lang.java script for javascript questions.
            >>
            (top posting fixed)
            I usually catch the submit action from the submit button. Would you care
            to see what that gives? The event procedure must cancel the default
            action, cross-browser... let me look this one up... nah, return false
            will do.
            >
            For javascript, not PHP.
            Does that help enough?
            >
            No.
            Yow, now I re-read your snippet, something strikes me: inside the
            inline onsubmit definition, there is no need to put 'javascript:'.
            Maybe that is all it takes.
            >
            Or, since this is javacript, maybe he needs to follow up in a javascript
            newsgroup.

            P.S. Please don't top post. Thanks.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            Working...