首页 > 解决方案 > 将错误值传递给模板中的 JS 代码。姜戈

问题描述

我已经购买了其中一个 Bootstrap 模板。我正在尝试将视图或 forms.py 中的值传递给我的模板

    <div class="input-group">
      <textarea class="form-control" rows="4" name="text" placeholder="Hi there, I would like to ..." aria-label="Hi there, I would like to ..." required
                data-msg="Please enter a reason."
                data-error-class="u-has-error"
                data-success-class="u-has-success"></textarea>
    </div>

正是这个值data-msg="Please enter a reason."

我怎样才能做到这一点?将值传递给 JS 代码还是有可能?如何更改将由 JS 代码显示的消息的内容。

标签: djangoforms

解决方案


推荐阅读