Article previous html
Jump to navigation
Jump to search
| Line 290: | Line 290: | ||
var month = $(this).find('[name="Form article[month]"]').val(); | var month = $(this).find('[name="Form article[month]"]').val(); | ||
var year = $(this).find('[name="Form article[year]"]').val(); | var year = $(this).find('[name="Form article[year]"]').val(); | ||
| + | var day = $(this).find('[name="Form article[day]"]').val(); | ||
| + | |||
| + | var required = { | ||
| + | article: ['Title,'Authors'], | ||
| + | post: ['Title,'month','year'], | ||
| + | news: ['Title,'day', 'month','year'] | ||
| + | } | ||
| + | |||
| + | if(required.hasOwnProperty(type))) { | ||
| + | for(var i in required[type])) { | ||
| + | if(!$(this).find('[name="Form article[' + required[type][i] + ']"]').val()) { | ||
| + | alert('Please enter ' + type + ' ' + required[type][i]); | ||
| + | return false; | ||
| + | } | ||
| + | } | ||
| + | } | ||
var obj_months = { | var obj_months = { | ||
| Line 318: | Line 334: | ||
// && will not work correctly ! | // && will not work correctly ! | ||
// if(month && year) | // if(month && year) | ||
| − | + | alert(month) | |
var month_year = false; | var month_year = false; | ||
| − | if( month ) { | + | if(month) { |
if(year) { | if(year) { | ||
month_year = true; | month_year = true; | ||
} | } | ||
} | } | ||
| − | + | alert(month_year) | |
if(month_year) { | if(month_year) { | ||
pagename += obj_months[month] + ' ' + year + ' - ' + title; | pagename += obj_months[month] + ' ' + year + ' - ' + title; | ||
Revision as of 08:28, 12 March 2020