【问题标题】:Does Bootstrap Tour allow error message validation?Bootstrap Tour 是否允许错误消息验证?
【发布时间】:2018-10-19 17:59:55
【问题描述】:

我正在使用 Bootstrap 游览,但问题是我只需要游览/突出显示不正确的字段。 Bootstrap tour 的问题在于硬编码所有元素的 id 或类名。我的表单错误是基于不正确的字段。所以我无法对字段 ID 进行硬编码,因为在用户填写表单之前我不知道哪些字段不正确。

// Instance the tour
    var tour = new Tour({
    backdrop: true,
    steps: [
    {
      element: "#primary-address-line-label-2",
      title: "Title of my step",
      content: `<h3 class="tool-tip-title">Review/Update Your Address</h3>
      <div class="tip-content">
      <p>Our records indicate the address we have on file for you may be incorrect.</p>
      <p>Please make any edits in the field below. Click "Save & Continue" once you are finished.</p>
      </div>
      <div class="number-of-actions">1 of 5 Actions</div>`,
      placement: "top"
    }
  ]});


  // Initialize the tour
  tour.init();

  // Start the tour
  tour.start(); 

我的html是:

<div>
  <label>City</label>
 <input class="form-control" type="text" id="City" class="error"><span style="display: inline-block;">City is required.</span>
 </div>

<div>
  <label>City</label>
 <input class="form-control" type="text" id="State" class="error"><span style="display: inline-block;">State is required.</span>
 </div>

从我的示例中可以看出,城市和州字段具有错误类并且不正确,但根据用户输入,任何字段都可能不正确。

Bootstrap tour 是否能够根据不正确的字段创建动态元素/步骤?

是否有任何其他使用工具提示验证字段的 jQuery 或 JavaScript 插件?

Bootstrap Tour 位于here

【问题讨论】:

    标签: javascript jquery jquery-plugins bootstrap-tour


    【解决方案1】:

    嘿,伙计,我在找你的家伙,在关于 Boostrap Tour 的官方 API 中,他们没有显示任何关于验证的信息,这是 API 的官方网站 http://bootstraptour.com/api/

    【讨论】:

    • 您好,欢迎来到 StackOverflow!在提供文档链接时,请简要说明您引用它的原因。这可以通过提供快速代码示例或引用特定段落来实现。 “只是 RTFM!”很少会帮助 OP 寻找问题。此外,如果答案对您有意义,则更有可能对其他人有意义(我确定您在寻找什么“老兄”:))
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-24
    • 2017-03-22
    • 2018-12-10
    • 1970-01-01
    • 2022-06-13
    • 2023-01-24
    相关资源
    最近更新 更多