1

How to style the dialog “onclick” button?

I have created a button with a “onClick” dialog, waiting for the user's response:

let check := dialog("Atención", "¿Confirma la eliminación de la transacción?", ["Si", "No"]);
if check = "Si" then
delete this;
openTable("Cuenta Nº 1", "all");
closeAllRecords()
else
closeRecord()
end

This is the result:


it works, but it does not have the appearance of the dialog box like the one in the trash can:

 

Further, when I add the styled function, the button does not work:
let check := dialog("Atención", "¿Confirma la eliminación de la transacción?", ["Si", "No"]);
styled ("Si", "red");
if check = "Si" then
delete this;
openTable("Cuenta Nº 1", "all");
closeAllRecords()
else
closeRecord()
end

How can I style the inner buttons of the dialog?
Regards, thanks in advance.

6 replies

null
    • Sean
    • 2 yrs ago
    • Reported - view

    I think you have to use a CSS hack to accomplish that. If you are using the Mac app you can edit the CSS file directly. If not, you can put this formula in a Formula field, but it only works if the Form is active.

     

    html("
    <style>
    .nx-button-text.grey:nth-child(4) {
    color: #e64e29;
    background-color: #ffe5e0;
    border: 1px solid #e64e29;
    }
    .nx-button-text.grey:nth-child(4):hover {
    background-color: #ffccc2;
    }
    .nx-button-text.grey:nth-child(4):active {
    background-color: #ffb2a3;
    }
    </style>
    ")

    • clonev
    • 2 yrs ago
    • Reported - view

    Thank you. But, where should I write the code. sorry (I'm new to using javascript). Regards. 

    • Sean
    • 2 yrs ago
    • Reported - view

    This is CSS not JavaScript. You have to add a Formula field on the same form where the button is located and enter the code in the Formula field. The field can't be hidden using "Display field only, if:", but you can camouflage it by setting the background color to the color of your form and set the "Label position" to "Hidden".

    • clonev
    • 2 yrs ago
    • Reported - view

    Ok, I try it. Thank you

    • clonev
    • 2 yrs ago
    • Reported - view

    Hi, Sean!

    The code works as I wanted it!!!, thanks.

    • Sean
    • 2 yrs ago
    • Reported - view

    You're welcome. Glad you got it working :)

Content aside

  • 1 Likes
  • 2 yrs agoLast active
  • 6Replies
  • 517Views
  • 1 Following