Dear all,

i am having a very small input form where the user is inputting the start time and the end time and then clicking on submit. The problem is that when I try to validate the form with onsubmit="return validate_timesheet()" the values that i want to validate (start & end time) are transferred right to the form (when I alert the values they are fine) but when I compare them (checking if start time is smaller then end time) the if clause is not working right. I have put a small fiddle together on

jsfiddle.net/swaSk/11

Can anybody help me here?

All the best and many thanks
Georg

Here also the code just in case:

HTML
Code:
<form name="timesheet_office1" onsubmit="return validate_timesheet()">
 <select class="normal" name="time_arrival_customer_hrs">

                      <option value='0'>0</option>

                      <option value='1'>1</option>

                      <option value='2'>2</option>

                      <option value='3'>3</option>

                      <option value='4'>4</option>

                      <option value='5'>5</option>

                      <option value='6'>6</option>

                      <option value='7'>7</option>

                      <option value='8'>8</option>

                      <option value='9' selected="selected">9</option>

                      <option value='10'>10</option>

                      <option value='11'>11</option>

                      <option value='12'>12</option>

                      <option value='13'>13</option>

                      <option value='14'>14</option>

                      <option value='15'>15</option>

                      <option value='16'>16</option>

                      <option value='17'>17</option>

                      <option value='18'>18</option>

                      <option value='19'>19</option>

                      <option value='20'>20</option>

                      <option value='21'>21</option>

                      <option value='22'>22</option>

                      <option value='23'>23</option>

                    </select>

                    <select class="normal" name="time_arrival_customer_min">

                      <option value='00'>00</option>

                      <option value='15'>15</option>

                      <option value='30' selected="selected">30</option>

                      <option value='45'>45</option>

                    </select>

    <select class="normal" name="time_departure_customer_hrs">

                      <option value='0'>0</option>

                      <option value='1'>1</option>

                      <option value='2'>2</option>

                      <option value='3'>3</option>

                      <option value='4'>4</option>

                      <option value='5'>5</option>

                      <option value='6'>6</option>

                      <option value='7'>7</option>

                      <option value='8'>8</option>

                      <option value='9'>9</option>

                      <option value='10'>10</option>

                      <option value='11'>11</option>

                      <option value='12'>12</option>

                      <option value='13'>13</option>

                      <option value='14'>14</option>

                      <option value='15'>15</option>

                      <option value='16'>16</option>

                      <option value='17' selected="selected">17</option>

                      <option value='18'>18</option>

                      <option value='19'>19</option>

                      <option value='20'>20</option>

                      <option value='21'>21</option>

                      <option value='22'>22</option>

                      <option value='23'>23</option>

                    </select>

                    <select class="normal" name="time_departure_customer_min">

                      <option value='00'>00</option>

                      <option value='15'>15</option>

                      <option value='30' selected="selected">30</option>

                      <option value='45'>45</option>

                    </select>

<input type="submit" value="submit">
</form>


JAVASCRIPT

function validate_timesheet()
{
var arrival_customer_hrs=document.forms["timesheet_office1"]["time_arrival_customer_hrs"].value;
var arrival_customer_min=document.forms["timesheet_office1"]["time_arrival_customer_min"].value;

var departure_customer_hrs=document.forms["timesheet_office1"]["time_departure_customer_hrs"].value;
var departure_customer_min=document.forms["timesheet_office1"]["time_departure_customer_min"].value;

    if (arrival_customer_hrs > departure_customer_hrs){
      alert ("The arrival time is bigger than the departure time");
      return false;
    }
    if (arrival_customer_hrs == departure_customer_hrs && arrival_customer_min > departure_customer_min){
      alert ("Arrival time (min) is bigger than the departure time");
    return false;
    }
}