Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery validator and bootstrap.js - Notifications/Errors
    primarykey
    data
    text
    <p>I'm exploring jQuery and bootstrap.js for a single page site. When not being strong in complex CSS and jQuery this can be a bit of a hassle. My goal is simple building on their hero-box example, which has a login form in the top right corner as seen here: <a href="http://twitter.github.com/bootstrap/examples/hero.html" rel="nofollow">http://twitter.github.com/bootstrap/examples/hero.html</a></p> <p>I've got a working form for creating users, where i used this example: <a href="http://alittlecode.com/files/jQuery-Validate-Demo/" rel="nofollow">http://alittlecode.com/files/jQuery-Validate-Demo/</a></p> <p>The goal is combining it with something like these notifications/alerts: <a href="http://www.w3resource.com/twitter-bootstrap/alerts-and-errors-tutorial.php" rel="nofollow">http://www.w3resource.com/twitter-bootstrap/alerts-and-errors-tutorial.php</a></p> <p>The relevant parts i have is: </p> <pre><code>$(document).ready(function(){ $.validator.addMethod('validChars', function (value) { var iChars = "!#$%^&amp;*()+=-[]\\\';,/{}|\":&lt;&gt;?"; for (var i = 0; i &lt; value.length; i++) { if (iChars.indexOf(value.charAt(i)) != -1) { return false; } } return true; }); $('#login_form').validate( { rules: { login_email: { required: true, validChars:true, maxlength:50 }, login_password: { validChars:true, required: true } }, highlight: function(input) { $(input).closest('.control-group').addClass('error'); }, unhighlight: function(input) { $(input).closest('.control-group').addClass('success'); } }); }); </code></pre> <p>And my form looks like this: </p> <pre><code> &lt;form id="login_form" name="login_form"; class="navbar-form pull-right control-group" action=""&gt; &lt;input class="span2 control-group" placeholder="Email" name="login_email" id="login_email"&gt; &lt;input class="span2 control-group" placeholder="Password" name="login_password" id="login_password"&gt; &lt;button class="btn login" type="button" onclick="login();"&gt;Sign in&lt;/button&gt; &lt;button class="btn requestor" type="button" onclick="createForm();" &gt;Create new account&lt;/button&gt; &lt;/form&gt; </code></pre> <p>Nothing at all happens, and I'm really out of ideas. </p> <p>The ambition of notification or events are illustrative, my main concern is getting the validation connected to the form. </p> <p>Thank you in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload