dttwois6098 2015-03-18 02:31
浏览 385

Bootstrap阻止表单提交

I am using the startbootstrap-clean-blog-1.0.2 template as a base for my general project. I am currently making a small list/view application (My first try at such a thing). When i click the 'submit button' in my form, bootstaps validation script for the contact form runs and prevents the form from submitting due to 'indexof' conflicts/errors (if i am guessing correctly)

Using Chromes developer tools I found the following error when I click the submit button:

Uncaught TypeError: Cannot read property 'indexOf' of undefined 
(Clean-blog.js:25)

$.jqBootstrapValidation.submitSuccess 
(Clean-blog.js:25)

(anonymous function)
Clean-blog.js:25

jquery.js:4409 jQuery.event.dispatch
(jquery.js:4095) 

jQuery.event.add.elemData.handle
(jquery.js:4095)

I've no real understanding of javascript or jQuery, still learning PHP. The errors seem to have something to do with a validation script for the contact form WHICH my list/View page has nothing to with (or so i thought). All I am trying to do is make sure that my form works (When I click the button, it goes to the submitted.php page). How can I get the page to submit?

I've seen many posts asking 'how to prevent a submit' but nothing on how to get a form in bootstrap to submit' on stack.

This is my code:

<form class='' action='sent.php' method='post' name='sendTest'>
                    <ul>
                        <li>
                            <h2>TEST</h2>
                        </li>
                        <li>
                            <label for='name'>Name:</label>
                            <input type='text' name='name' />
                        </li>
                        <li>
                            <button type='submit'>Insert Name</button>
                        </li>
                    </ul>

                </form>
  • 写回答

2条回答 默认 最新

  • dongzhang8475 2015-03-18 03:08
    关注

    The clean-blog expects an input element with id name(var name = $("input#name").val()) which is not there in your code

    <input type='text' name='name' id="name"/>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大