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"/>
    
    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型