olympiamanagement/app/assets/javascripts/admin/olympiamanagement.js

24 lines
1011 B
JavaScript

$(document).ready(function(){
$('.fieldset_block input[type="submit"]').click(function(){
$el = $('.fieldset_block li.required');
for(var i = 0; i< $el.length ; i++){
if($el.eq(i).siblings('.col_r').find('.required').val() == ""){
$el.eq(i).addClass('errFld');
if($el.eq(i).siblings('.col_r').find('.errMsg').length == 0)
$el.eq(i).siblings('.col_r').append('<div id="SchoolName-E" class="errMsg"> '+((I18n.locale == "en") ? 'Required field': '必填欄位')+'</div>');
}else{
$el.eq(i).removeClass('errFld');
$el.eq(i).siblings('.col_r').find('.errMsg').remove();
};
};
if($('.fieldset_block .required.errFld').length != 0)
return false;
else
return true;
})
var $el = $('.fieldset_block select');
for(var i = 0 ; i < $el.length ; i++)
if($el.eq(i).attr('value') != "" && $el.eq(i).attr('value') != undefined)
$el.eq(i).find('option[value='+$el.eq(i).attr('value')+']').attr('selected','selected');
try{CKEDITOR.replaceAll()}catch(e){console.log(e)};
});