/* @file Defines the simple modal behavior */ (function ($) { Drupal.behaviors.validates = { attach: function(context, settings) { var nodeType = Drupal.settings.event_popup.content_type; nodeType = nodeType.replace('_', '-'); var formId = '#' + nodeType + '-node-form #edit-submit'; $( formId ).click(function () { if ($("#display_error").length == 0) { $('#event-calendar-node-form').prepend('
'); } var eventTitle = $( '#edit-title'), startDate = $( '#edit-event-calendar-date-und-0-value-datepicker-popup-0' ), endDate = $( '#edit-event-calendar-date-und-0-value2-datepicker-popup-0' ), showEndDate = $( '#edit-event-calendar-date-und-0-show-todate'), allFields = $( [] ).add( eventTitle ).add( startDate ).add( endDate ), tips = $( '#cl' ); var bValid = true; allFields.removeClass( "ui-state-error" ); bValid = bValid && checkLength( eventTitle, "Event title", 1 ); if(showEndDate.attr('checked')) { bValid = bValid && DateCompare( startDate, endDate ); } if(!bValid) { return false; } function updateTips( t ) { tips ( '