Revision: 1546
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1546&view=rev
Author:   cimorrison
Date:     2010-10-25 16:18:44 +0000 (Mon, 25 Oct 2010)

Log Message:
-----------
Fixed JavaScript undefined object problem

Modified Paths:
--------------
    mrbs/branches/from_to_bookings/web/Themes/default/header.inc

Modified: mrbs/branches/from_to_bookings/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/from_to_bookings/web/Themes/default/header.inc        
2010-10-25 11:42:53 UTC (rev 1545)
+++ mrbs/branches/from_to_bookings/web/Themes/default/header.inc        
2010-10-25 16:18:44 UTC (rev 1546)
@@ -406,6 +406,12 @@
     // (c) Make sure that you can't have an end time before the start time.
     // (d) Tidy up the two select boxes so that they are the same width
     ?>
+    
+    if (!form)
+    {
+      return;
+    }
+    
     var isSelected, i, j;
     var nbsp = '\u00A0';
     var errorText = '<?php echo get_vocab("start_after_end")?>';
@@ -624,45 +630,46 @@
   if (form && form.name && (form.name.value.length == 0))
   {
     form.name.focus();
-  }
-  <?php
-  // Get the current vocab (in the appropriate language) for periods,
-  // minutes, hours
-  ?>
-  vocab['periods'] = new Array();
-  vocab['periods']['singular'] = '<?php echo get_vocab("period_lc") ?>';
-  vocab['periods']['plural'] = '<?php echo get_vocab("periods") ?>';
-  vocab['minutes'] = new Array();
-  vocab['minutes']['singular'] = '<?php echo get_vocab("minute_lc") ?>';
-  vocab['minutes']['plural'] = '<?php echo get_vocab("minutes") ?>';
-  vocab['hours'] = new Array();
-  vocab['hours']['singular'] = '<?php echo get_vocab("hour_lc") ?>';
-  vocab['hours']['plural'] = '<?php echo get_vocab("hours") ?>';
-  vocab['days'] = new Array();
-  vocab['days']['singular'] = '<?php echo get_vocab("day_lc") ?>';
-  vocab['days']['plural'] = '<?php echo get_vocab("days") ?>';
-  <?php
-  // Get the details of the start and end slot selectors now since
-  // they are fully populated with options.  We can then use the details
-  // to rebuild the selectors later on
-  ?>
-  nStartOptions = form.start_seconds.options.length;
-  for (var i=0; i < nStartOptions; i++)
-  {
-    startOptions[i] = new Array();
-    startOptions[i]['text'] = form.start_seconds.options[i].text;
-    startOptions[i]['value'] = parseInt(form.start_seconds.options[i].value);
-  }
+    <?php
+    // Get the current vocab (in the appropriate language) for periods,
+    // minutes, hours
+    ?>
+    vocab['periods'] = new Array();
+    vocab['periods']['singular'] = '<?php echo get_vocab("period_lc") ?>';
+    vocab['periods']['plural'] = '<?php echo get_vocab("periods") ?>';
+    vocab['minutes'] = new Array();
+    vocab['minutes']['singular'] = '<?php echo get_vocab("minute_lc") ?>';
+    vocab['minutes']['plural'] = '<?php echo get_vocab("minutes") ?>';
+    vocab['hours'] = new Array();
+    vocab['hours']['singular'] = '<?php echo get_vocab("hour_lc") ?>';
+    vocab['hours']['plural'] = '<?php echo get_vocab("hours") ?>';
+    vocab['days'] = new Array();
+    vocab['days']['singular'] = '<?php echo get_vocab("day_lc") ?>';
+    vocab['days']['plural'] = '<?php echo get_vocab("days") ?>';
+    <?php
+    // Get the details of the start and end slot selectors now since
+    // they are fully populated with options.  We can then use the details
+    // to rebuild the selectors later on
+    ?>
+    nStartOptions = form.start_seconds.options.length;
+    for (var i=0; i < nStartOptions; i++)
+    {
+      startOptions[i] = new Array();
+      startOptions[i]['text'] = form.start_seconds.options[i].text;
+      startOptions[i]['value'] = parseInt(form.start_seconds.options[i].value);
+    }
   
-  nEndOptions = form.end_seconds.options.length;
-  for (var i=0; i < nEndOptions; i++)
-  {
-    endOptions[i] = new Array();
-    endOptions[i]['text'] = form.end_seconds.options[i].text;
-    endOptions[i]['value'] = parseInt(form.end_seconds.options[i].value);
+    nEndOptions = form.end_seconds.options.length;
+    for (var i=0; i < nEndOptions; i++)
+    {
+      endOptions[i] = new Array();
+      endOptions[i]['text'] = form.end_seconds.options[i].text;
+      endOptions[i]['value'] = parseInt(form.end_seconds.options[i].value);
+    }
+  
+    adjustSlotSelectors(form);
   }
-  
-  adjustSlotSelectors(form);
+
   <?php
   }
   


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to