0

How to change the alignment of a button of an alert

Hi. I have created an alert after the user needs to cancel a record. The problem is that by clicking on the "ok" of the alert the user also opens a record again. I want to align the "ok" of the alert to the left so solve this problem. Does anyone know how to do this?

12 replies

null
    • szormpas
    • 2 mths ago
    • Reported - view

     Hi, alternatively you can use the dialog function like below:

    let check := dialog("Alert!", "Are you sure that you want to delete this record?", ["YES", "NO"]);
    if check = "YES" then delete this end
    

     

     said:
    The problem is that by clicking on the "ok" of the alert the user also opens a record again

     I am not sure how this could happen. Can you share your code?

      • jesusfreakk_alex
      • 2 mths ago
      • Reported - view

       

      let d1 := dialog("Did you update a record?", "Do you want to delete this record?" +
          "

      " +
          "Or was it updated?", ["Cancel the record", "Keep this record"]);
      if d1 = "Cancel the record" then
          delete this;
          alert("Record deleted");
          let xfirst := openRecord(first(select Dashboard));
          void
      else
          closeRecord();
          alert("Record saved");
          openRecord(first(select Dashboard))
      end

       

      Right under the "Ok" button of the Alert is the button to create a new record.

      That's why I want to change the alignment of the button in the alert.

      • szormpas
      • 2 mths ago
      • Reported - view

        can you upload a screenshot?

      • jesusfreakk_alex
      • 2 mths ago
      • Reported - view

       

      • szormpas
      • 2 mths ago
      • Reported - view

        Hi, I still don't understand why it's a problem to press OK to close the alert window and create a new record!

      • Fred
      • 2 mths ago
      • Reported - view

        I think the issue is if you accidentially double click you close the window and then create a new record.

      • jesusfreakk_alex
      • 2 mths ago
      • Reported - view

       This is exactly the problem

    • Sean
    • 2 mths ago
    • Reported - view

    Yes, you can have the button align left. You need to put this code in a Formula field and you can't hide the field using "Display field only, if:". Instead you have to hide the label and set the background color of the Formula field to the background color of the form.

    html("
    <style>
        .nx-alert .nx-hspace-flex {display: none;}
    </style>
    ")
    
      • jesusfreakk_alex
      • 2 mths ago
      • Reported - view

       I have tried this. Unfortunately it is not working. I assume I have to have this field in the same table with the button which has the alert?

      • Sean
      • 2 mths ago
      • Reported - view

       Yes, with this method the field would need to be in every table where you want the new button alignment behavior.

      There is another method that I explain in this post. You would just replace

      const myCustomCSS = '.nx-script-quick-fields{resize:horizontal;}';

      with

      const myCustomCSS = '.nx-alert .nx-hspace-flex{display: none;}';
    • Mel_Charles
    • 2 mths ago
    • Reported - view

    But if the button is moved to the left and then the user continues to double click then won't they open the underlying image instead (assuming you don't have this locked down) - isn't it easier to educate the user to the fact they only need to click the okay button Once? 

    I personally would not delete but set a "delete" flag to hide the record instead (or move it to an archive) and if required delete x records in batches behind the scenes later on.

      • Mel_Charles
      • 2 mths ago
      • Reported - view

       Like so... I set mine to "cancelled" then lock the record and and keep it visual for a while and auto soft delete them after 60 days

Content aside

  • 2 mths agoLast active
  • 12Replies
  • 73Views
  • 5 Following