Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery Tools validator with overlay
    primarykey
    data
    text
    <p>I'm getting some variant behaviour using jQuery Tools form dialog - i.e. using validator on a form contained in an overlay. Here is my code (should load straight up)</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Simple&lt;/title&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js"&gt;&lt;/script&gt; &lt;style type="text/css"&gt; .dialog { display: none; width: 400px; padding:5px; background-color:rgba(178, 168, 79, 0.7); border:2px solid #666; border:2px solid rgba(82, 82, 82, 0.7); -moz-border-radius:6px; -webkit-border-radius:6px; } form { background:#333; padding:15px 20px; color:#eee; width:360px; margin:0 auto; position:relative; -moz-border-radius:5px; -webkit-border-radius:5px; } form input { border:1px solid #444; background-color:#666; padding:5px; color:#ddd; font-size:12px; /* CSS3 spicing */ text-shadow:1px 1px 1px #000; -moz-border-radius:4px; -webkit-border-radius:4px; } form input:focus { color:#fff; background-color:#777; } form input:active { background-color:#888; } fieldset { border: 0; } .error { height:15px; background-color:#FFFE36; font-size:12px; border:1px solid #E1E16D; padding:4px 10px; color:#000; display:none; -moz-border-radius:4px; -webkit-border-radius:4px; -moz-border-radius-bottomleft:0; -moz-border-radius-topleft:0; -webkit-border-bottom-left-radius:0; -webkit-border-top-left-radius:0; -moz-box-shadow:0 0 6px #ddd; -webkit-box-shadow:0 0 6px #ddd; } form label { display:block; font-size:13px; color:#ccc; padding-bottom: 2px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;button type="button" name="dlgBtn"&gt;Show Dialog&lt;/button&gt; &lt;div class='dialog'&gt; &lt;form class='form'&gt; &lt;fieldset&gt; &lt;label&gt;Name&lt;/label&gt; &lt;input name="name" type="text" required="required" /&gt; &lt;/fieldset&gt; &lt;button type="submit"&gt;Submit&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;script&gt; $("button[name='dlgBtn']").click(function() { $("form")[0].reset(); $("div").data("overlay").load(); }); $("form").validator().submit(function() { $("div").data("overlay").close(); alert("Submitted OK!"); return false; }); $("div").overlay({top:180, closeOnClick: true, mask: {color: '#fff', loadSpeed: 100, opacity: 0.5}}); &lt;/script&gt; &lt;/html&gt; </code></pre> <p>This code has the following problems (in order of importance to this question) -</p> <ol> <li>In Chrome 8.0.552.231, the 'required' validator failure does not stop the form being submitted (it does in FF).</li> <li>In Chrome, the error message is not visible in relation to the dialog, but appears in the document body, and is only visible once the dialog closes.</li> <li>In Firefox 4b7, the validator error appears below the input regardless of any position setting when initialising the validator. It should appear on the right by default.</li> <li>In FF, the form.reset() does not reset the form (it does in chrome). This can be tested by opening the dialog a second time after submitting. At first glance doesn't look to be jquery Tools related, but thought I'd throw it in :).</li> <li>In Chrome , the field border is not initially red (it is in FF)</li> <li>In FF, the field border does not turn blue when selected (it does in Chrome)</li> <li>The error message text for FF and Chrome is different</li> </ol> <p>Other people seeing the same behaviour? Is it possible to fix that code to work as expected, and vaguely the same in both browsers? Cheers,</p>
    singulars
    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