[ljcom] r10018: LJINT-388: empty fields check improvment...
Committer: szhirkov
LJINT-388: empty fields check improvment (Kommersant comments)U trunk/htdocs/js/partners/placeholder.js U trunk/templates/Identity/ExternalLogin.tmpl
Modified: trunk/htdocs/js/partners/placeholder.js
===================================================================
--- trunk/htdocs/js/partners/placeholder.js 2011-02-10 11:08:22 UTC (rev 10017)
+++ trunk/htdocs/js/partners/placeholder.js 2011-02-10 11:35:56 UTC (rev 10018)
@@ -5,16 +5,16 @@
});
$(function () {
+ var submitButtons = $(':submit');
- setTimeout(function () {
-
- }, 1000);
-
$('.i-close').bind('click', function (e) {
e.preventDefault();
$(this).closest('.b-auth-error').fadeOut('fast');
});
$('#commenttext').trigger('focus');
+ $('form').bind('submit', function () {
+ submitButtons.attr('disabled', 'disabled');
+ });
});
$.fn.placeholder = function () {
Modified: trunk/templates/Identity/ExternalLogin.tmpl
===================================================================
--- trunk/templates/Identity/ExternalLogin.tmpl 2011-02-10 11:08:22 UTC (rev 10017)
+++ trunk/templates/Identity/ExternalLogin.tmpl 2011-02-10 11:35:56 UTC (rev 10018)
@@ -33,15 +33,15 @@
<p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.user.desc')"></p>
<p class="b-auth-user-form">
<span class="b-auth-input-wrapper">
- <label for="ljusername"><TMPL_VAR expr="ml('/identity/login.bml.user.label.name')"></label>
+ <label style="display:none;" for="ljusername"><TMPL_VAR expr="ml('/identity/login.bml.user.label.name')"></label>
<input type="text" name="user" id="ljusername" value="" class="b-auth-user-input" />
</span>
<span class="b-auth-input-wrapper">
- <label for="ljuserpassword"><TMPL_VAR expr="ml('/identity/login.bml.user.label.pass')"></label>
+ <label style="display:none;" for="ljuserpassword"><TMPL_VAR expr="ml('/identity/login.bml.user.label.pass')"></label>
<input type="password" name="password" id="ljuserpassword" value="" class="b-auth-user-input" />
<a target="_blank" href="<TMPL_VAR expr="ml('/identity/login.bml.user.help.link')">"><TMPL_VAR expr="ml('/identity/login.bml.user.help')"></a>
</span>
- <button type="submit"><TMPL_VAR expr="ml('/identity/login.bml.user.btn.login')"></button>
+ <button disabled="disabled" type="submit"><TMPL_VAR expr="ml('/identity/login.bml.user.btn.login')"></button>
</p>
<TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
@@ -57,11 +57,11 @@
<p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.openid.desc')"></p>
<p class="b-auth-openid-form">
<span class="b-auth-input-wrapper">
- <label for="openid_url"><TMPL_VAR expr="ml('/identity/login.bml.openid.label.url')"></label>
+ <label style="display:none;" for="openid_url"><TMPL_VAR expr="ml('/identity/login.bml.openid.label.url')"></label>
<input type="url" name="openid:url" id="openid_url" value="" class="b-auth-openid-input" />
<span><TMPL_VAR expr="ml('/identity/login.bml.openid.label.sample')"></span>
</span>
- <button type="submit"><TMPL_VAR expr="ml('/identity/login.bml.openid.btn.login')"></button>
+ <button disabled="disabled" type="submit"><TMPL_VAR expr="ml('/identity/login.bml.openid.btn.login')"></button>
</p>
<TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
@@ -116,7 +116,17 @@
inputFields
.bind('change keyup', function () {
- if ($.trim($(this).val()) === '') {
+ var someInputIsEmpty = false;
+
+ inputFields.each(function () {
+ var currentInput = $(this);
+
+ if ($.trim(currentInput.val()) === '') {
+ someInputIsEmpty = true;
+ }
+ });
+
+ if (someInputIsEmpty) {
submitButton.attr('disabled', 'disabled');
} else {
submitButton.removeAttr('disabled');
