Expand my Community achievements bar.

SOLVED

Send an "Are you sure?" question

Avatar

Level 2

I have a form and can add or remove steps and the tasks that go under them but the remove takes the data with it and there is no "un-do". My people would like the delete button to say something like "Are you sure  you want to delete this task? Data cannot be recovered after it is deleted." and be able to click "no" or "cancel" if they have clicked the remove button on accident.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

// form1.page1.areYouSureBtn::click - (JavaScript, client)

var yesOrNo = xfa.host.messageBox("Are you sure?","Do Not Press That Button",2,2);

if (yesOrNo == 3) {

     xfa.host.messageBox("The answer is 'No'.","Negative Response",3);

}

else {

     if (yesOrNo == 4) {

          xfa.host.messageBox("The answer is 'Yes'.","Positive Response",3);

     }

}

messageBox

param1

A valid string representing the message to display.

param2(Optional)

A valid string representing the title to appear in the title bar of the dialog window.

To help protect against internet spoofing, the dialog window title begins with the text "Warning: JavaScript Window -". The window title that you specify in this parameter displays after the warning text.

param3(Optional)

An integer representing the icon to display in the dialog box.

  • 0 (Error) - This is the default.
  • 1 (Warning)
  • 2 (Question)
  • 3 (Status)

param4(Optional)

An integer representing the buttons to display.

  • 0 (OK) - This is the default.
  • 1 (OK, Cancel)
  • 2 (Yes, No)
  • 3 (Yes, No, Cancel)

Returns

A valid integer representing the value of the button pressed by the user:

  • 1 (OK)
  • 2 (Cancel)
  • 3 (No)
  • 4 (Yes)

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

// form1.page1.areYouSureBtn::click - (JavaScript, client)

var yesOrNo = xfa.host.messageBox("Are you sure?","Do Not Press That Button",2,2);

if (yesOrNo == 3) {

     xfa.host.messageBox("The answer is 'No'.","Negative Response",3);

}

else {

     if (yesOrNo == 4) {

          xfa.host.messageBox("The answer is 'Yes'.","Positive Response",3);

     }

}

messageBox

param1

A valid string representing the message to display.

param2(Optional)

A valid string representing the title to appear in the title bar of the dialog window.

To help protect against internet spoofing, the dialog window title begins with the text "Warning: JavaScript Window -". The window title that you specify in this parameter displays after the warning text.

param3(Optional)

An integer representing the icon to display in the dialog box.

  • 0 (Error) - This is the default.
  • 1 (Warning)
  • 2 (Question)
  • 3 (Status)

param4(Optional)

An integer representing the buttons to display.

  • 0 (OK) - This is the default.
  • 1 (OK, Cancel)
  • 2 (Yes, No)
  • 3 (Yes, No, Cancel)

Returns

A valid integer representing the value of the button pressed by the user:

  • 1 (OK)
  • 2 (Cancel)
  • 3 (No)
  • 4 (Yes)

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----