【问题标题】:Call another prompt after submit prompt提交提示后调用另一个提示
【发布时间】:2015-01-07 05:15:37
【问题描述】:

我想在提交答案后调用另一个提示,但是 LoadNewRecord 中的 .prompt 函数没有出现。有什么想法吗?

提交提示

$.prompt("Opening Recap with ID " + Recap[0][0].id + ".<br> Note: Any changes on Recap " + header.find("#recap_id").val() + " will not be saved.", {
  title: "WARNING",
  buttons: {
    "Continue": true,
    "Cancel": false
  },
  submit: function(e, v, m, f) {
    var Recap_status;
    if (v === true) {
      Recap_status = Recap[0][0].status;
      LoadNewRecord(Recap, header);
      return $("#error_history").hide();
    } else {
      return selectedRecap();
    }
  }
});

LoadNewRecord 函数中的提示:

if (period_lock >= getDateInput(Recap[0][0].recap_date) && Recap_status < 20) {
  setTimeout((function() {
    $.prompt("You are not allowed to make any changes for all documents before " + period_lock + ". Please contact your administrator for further information");
  }), 100);
}

注意: 我在阅读此question 后使用setTimeout,但仍然无法正常工作..

如果我删除 LoadNewRecode 中的 $.prompt 或将其更改为 alert 一切正常。

【问题讨论】:

  • 如何在外部访问Recap_status,因为它是提交函数的局部变量
  • Recap_status 是一个全局变量,为简单起见,如果我删除LoadNewRecode 中的$.prompt 或将其更改为alert,一切正常。

标签: javascript impromptu


【解决方案1】:

遇到这个问题的小伙伴们,只需下载最新的即兴版here..

更多详情可以参考this Github 上的帖子..

【讨论】:

    猜你喜欢
    • 2021-12-07
    • 2023-04-05
    • 2015-08-28
    • 1970-01-01
    • 2011-03-01
    • 1970-01-01
    • 2021-01-25
    • 2012-02-10
    • 1970-01-01
    相关资源
    最近更新 更多