76 lines
2.3 KiB
JavaScript
76 lines
2.3 KiB
JavaScript
/* Woman's Voice
|
|
* links.js: The related-link related JavaScript subroutines.
|
|
*/
|
|
|
|
/* Copyright (c) 2000-2018 imacat.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
/* Author: imacat <imacat@mail.imacat.idv.tw>
|
|
* First written: 2000-06-28
|
|
*/
|
|
|
|
// isRegisterOK: Check if the register form is ready to be submitted
|
|
function isRegisterOK(form) {
|
|
|
|
// Regularize the fields
|
|
form.title.value = trim(form.title.value);
|
|
form.title_2ln.value = trim(form.title_2ln.value);
|
|
form.url.value = trim(form.url.value);
|
|
form.icon.value = trim(form.icon.value);
|
|
form.cat0.value = trim(form.cat0.value);
|
|
form.cat1.value = trim(form.cat1.value);
|
|
form.cat2.value = trim(form.cat2.value);
|
|
form.dsc.value = trimText(form.dsc.value);
|
|
form.email.value = trim(form.email.value);
|
|
form.addr.value = trim(form.addr.value);
|
|
form.tel.value = trim(form.tel.value);
|
|
form.fax.value = trim(form.fax.value);
|
|
|
|
// Check the site name
|
|
if (form.title.value == "") {
|
|
alert(_("Please fill in the site name."));
|
|
form.title.focus();
|
|
return false;
|
|
}
|
|
|
|
// Check the URL
|
|
if (form.url.value == "" || form.url.value == "http://") {
|
|
alert(_("Please fill in the URL."));
|
|
form.url.focus();
|
|
return false;
|
|
}
|
|
|
|
// Check the description
|
|
if (form.dsc.value == "" || form.dsc.value == _("Fill in the description here.")) {
|
|
alert(_("Please fill in the description."));
|
|
form.dsc.focus();
|
|
return false;
|
|
}
|
|
if (form.dsc.value.length > 256) {
|
|
alert(_("This description is too long. (Max. 256 letters)"));
|
|
form.dsc.focus();
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// clearDscDefault: Clear the default value of the description
|
|
function clearDscDefault(dsc, deftext) {
|
|
if (dsc.value == deftext) {
|
|
dsc.value = "";
|
|
}
|
|
}
|