Announcement

Collapse
No announcement yet.

Clicking on a button I have to show a initial message with if

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

  • Clicking on a button I have to show a initial message with if

    Hello all,
    I got a form button with php code inside.
    When I click on it the first message is ....

    echo '<script>alert("Attention, now it will be create an Order which will contain all rows selected \nAll row previously selected will be deleteted");</script>';

    How can I stop the prosecusion if the user instead ok click the "OK" button of Alert --- it press "ESC" key to abandon the action.

    If click ESC ---> sc_exit(sel); or to previous form
    If click OK ---> carry on doing code.


    I founded this googling but I don't know how insert PHP code or macro (sc_exit(sel); or all code to run if YES) into an echo istruction
    For istance x is a variable == true or == false ?? In SC I need to use $var not var only correct ?
    Can I refer to it out of the echo line like IF (x==false) {sc_exit(sel); } else { run php code }

    echo '<script type="text/javascript">
    var x=window.confirm("Are you sure you are ok?")
    if (x)
    window.alert("Good!")
    else
    window.alert("Too bad")
    </script>';

    Thanks
    Last edited by giovannino; 10-21-2015, 06:11 AM.

  • #2
    Look at the parameters at the button. You can set a confirmation message there and all logic for continuation and abort is already there.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Hello Albert,
      thanks

      I got this php code within button

      $result_sql = 0;
      $sql_check_div = "SELECT IF( EXISTS( SELECT * FROM `products_selected` where CustomerID = '[glo_CustomerID]' ) , 1, 2 )";
      //$sql_check_div = "SELECT COUNT(*) FROM `products_selected` where CustomerID = '[glo_CustomerID]' ";
      sc_lookup(my_data, $sql_check_div);
      $result_sql = {my_data[0][0]};

      if ($result_sql > 1)
      {
      echo '<script>alert("There are no rows to be elaborated - Select at list a product !"); </script>';
      sc_exit(sel);
      }
      else
      {

      echo '<script type="text/javascript">
      var x=window.confirm("Attention, now it will be create an Order which will contain all rows selected \nAll row previously selected will be deleteted")
      <? $rispo==(x);?> //NO WAYYYYY !!!!

      </script>';

      if ((x) == false) {sc_exit(sel);} // If clicked NO....

      else { ..................... }

      On confirmation message I can insert a text I suppose .
      How can I obtain what I'm trying to do ?

      need I to insert only "Attention, now it will be create an Order which will contain all rows selected \nAll row previously selected will be deleteted" ?

      Googling I founded another hint. Do you think that it can work ?

      echo '<script type="text/javascript">
      var x=window.confirm("Attenzione ora verrą creato un ordine che comprenderą tutte le righe selezionate - Tutte le righe dei prodotti precedentemente selezionate verranno poi cancellate\n\nAttention, now it will be create an Order which will contain all rows selected \nAll row previously selected will be deleteted")
      </script>';

      $rispo = '<script> document.write(x) </script>' ;
      echo "RISPO ". $rispo;

      if ($rispo == false) {sc_exit(sel);}
      else {
      Last edited by giovannino; 10-21-2015, 09:56 AM.

      Comment


      • #4
        You can't stop the execution of a PHP file. It's readed and "executed" completly at once
        /Giuseppe

        Professional Scriptcase Services
        Some Customers opinions

        Comment

        Working...
        X