public function init() {
$this->view->headScript()->appendFile('js/prototype.js');
$this->view->headScript()->appendFile('js/forms.js');
+ $this->view->headScript()->appendFile('js/highlight.js');
$this->view->headScript()->appendFile('js/account.js');
$this->view->headLink()->appendStylesheet('css/generic.css');
$this->view->headLink()->appendStylesheet('css/account.css');
public function init() {
$this->view->headScript()->appendFile('js/prototype.js');
$this->view->headScript()->appendFile('js/forms.js');
+ $this->view->headScript()->appendFile('js/highlight.js');
$this->view->headScript()->appendFile('js/contact.js');
$this->view->headLink()->appendStylesheet('css/generic.css');
$this->view->headLink()->appendStylesheet('css/contact.css');
$this->view->headScript()->appendFile('js/prototype.js');
$this->view->headScript()->appendFile('js/simplebox.js');
$this->view->headScript()->appendFile('js/closebtn.js');
+ $this->view->headScript()->appendFile('js/highlight.js');
$this->view->headScript()->appendFile('js/deck.js');
$this->view->headScript()->appendFile('js/ajaxize.js');
$this->view->headScript()->appendFile('js/message.js');
$this->view->headTitle($this->view->translate("login"));
$this->view->headScript()->appendFile('js/prototype.js');
$this->view->headScript()->appendFile('js/forms.js');
+ $this->view->headScript()->appendFile('js/highlight.js');
$this->view->headScript()->appendFile('js/login.js');
$this->view->headLink()->appendStylesheet('css/generic.css');
$this->view->headLink()->appendStylesheet('css/login.css');
public function init() {
$this->view->headScript()->appendFile('js/prototype.js');
$this->view->headScript()->appendFile('js/newpwd.js');
+ $this->view->headScript()->appendFile('js/highlight.js');
$this->view->headLink()->appendStylesheet('css/generic.css');
$this->view->headLink()->appendStylesheet('css/newpwd.css');
}
vertical-align: top;
}
+input {
+ /* transitions for highlight effects */
+ -webkit-transition: background-color 0.3s ease-out;
+ -moz-transition: background-color 0.3s ease-out;
+}
+
/*
* footer
*/
if (!errorElements.length) {
control = $("account_password");
- if (control.check(function() {
+ if (!control.check(function() {
return this.value === $("account_password_confirm").value;
}, SyjStrings.passwordNoMatchWarn)) {
errorElements.push(control);
* if there are errors, cancel submission
*/
if (errorElements.length) {
- errorElements[0].focus();
+ errorElements[0].highlight('#F08080').focus();
errorElements[0].select();
evt.stop();
}
* if there are errors, cancel submission
*/
if (errorElements.length) {
- errorElements[0].focus();
+ errorElements[0].highlight('#F08080').focus();
errorElements[0].select();
evt.stop();
}
tofocus = form.down('input:not([readonly],[disabled]),textarea:not([readonly][disabled])');
}
if (tofocus) {
+ if (error && (typeof tofocus.highlight == "function")) {
+ tofocus.highlight('#F08080');
+ }
tofocus.focus();
tofocus.select();
}
if (callback.call(control)) {
return true;
}
- control.focus();
- control.select();
control.insert({
after: new Element("div", {className: 'error'}).update(errorMessage)
});
--- /dev/null
+Element.addMethods({
+ highlight: function(element, color, timeout) {
+ var current;
+ if (typeof timeout === "undefined") {
+ timeout = 0.3;
+ }
+ current = element.getStyle('backgroundColor');
+ Element.setStyle(element, {'backgroundColor': color});
+ Element.setStyle.delay(timeout, element, {'backgroundColor': current});
+ return element;
+ }
+});
form.focus();
form.observe("submit", function(evt) {
+ var loginput = $("login_user");
$$('.error').invoke('remove');
- if (!$("login_user").check(function() { return !this.value.strip().empty(); }, SyjStrings.userEmptyWarn)) {
+ if (!loginput.check(function() { return !this.value.strip().empty(); }, SyjStrings.userEmptyWarn)) {
+ loginput.highlight('#F08080').focus();
+ loginput.select();
evt.stop();
return;
}
$$('.error').invoke('remove');
if ($('newpwd_email').value.strip().empty()) {
insertErrorBefore($('newpwdform').select('table')[0], SyjStrings.notEmptyField);
- $('newpwd_email').focus();
+ $('newpwd_email').highlight('#F08080').focus();
$('newpwd_email').select();
evt.stop();
}
checkNotEmpty: function(input, message) {
if ($(input).value.strip().empty()) {
this.messenger.setMessage(message, "warn");
- $(input).focus();
+ $(input).highlight('#F08080').focus();
return false;
}
return true;
this.messenger.setMessage(message, "error");
input = this.area.select('input[type="text"]')[0];
- input.focus();
+ input.highlight('#F08080').focus();
input.select();
},
if (!($("user_pseudo").value.match(/[a-zA-Z0-9_.]+$/))) {
this.messenger.setMessage(SyjStrings.invalidPseudo, "warn");
- $("user_pseudo").focus();
+ $("user_pseudo").highlight('#F08080').focus();
$("user_pseudo").select();
return false;
}
if ($("user_password").value.length < 6) {
$("user_password-desc").setMessageStatus("warn");
- $("user_password").focus();
+ $("user_password").highlight('#F08080').focus();
$("user_password").select();
return false;
}
if ($("user_password").value !== $("user_password_confirm").value) {
this.messenger.setMessage(SyjStrings.passwordNoMatchWarn, "warn");
- $("user_password").focus();
+ $("user_password").highlight('#F08080').focus();
$("user_password").select();
return false;
}
if (!$("user_accept").checked) {
this.messenger.setMessage(SyjStrings.acceptTermsofuseWarn, "warn");
- $("user_accept").focus();
+ $("user_accept").highlight('#F08080').focus();
return false;
}
if (message) {
this.messenger.setMessage(message, "error");
if (focusInput) {
- focusInput.focus();
+ focusInput.highlight('#F08080').focus();
focusInput.select();
}
return;
if (message) {
this.messenger.setMessage(message, "error");
if (focusInput) {
- focusInput.focus();
+ focusInput.highlight('#F08080').focus();
focusInput.select();
}
return;