From bc39f6d40dbff3d08a6712d3e4c593d06033a680 Mon Sep 17 00:00:00 2001 From: Alib Date: Tue, 23 Feb 2010 19:24:27 +0100 Subject: add form validation check for timers --- includes/inc_edittimer.php | 54 ++++++++++++++++++++++++++++++++++++++++++---- javascript/functions.js | 34 ++++++++++++++++++++++++++++- 2 files changed, 83 insertions(+), 5 deletions(-) diff --git a/includes/inc_edittimer.php b/includes/inc_edittimer.php index e362c94..8babf0c 100755 --- a/includes/inc_edittimer.php +++ b/includes/inc_edittimer.php @@ -17,7 +17,7 @@ else list($type, $channame, $date, $stime, $etime, $desc) = vdrgettimerinfo($timer); // Timer name -print "
\r\n"; +print "\r\n"; print " \r\n"; print " \r\n"; print " \r\n"; @@ -64,7 +82,15 @@ $ssec = substr($stime, 2); print "
  • "; print " \r\n"; + +if ($timer == -1) +{ +print " Select start time"; +} +else +{ print " {$smin}h{$ssec}"; +} print " "; print " "; print "
  • \r\n"; @@ -76,21 +102,41 @@ $emin = substr($etime, 0, 2); $esec = substr($etime, 2); print "
  • \r\n"; +if ($timer == -1) +{ +print " Select end time
  • \r\n"; +} +else +{ print " {$emin}h{$esec}\r\n"; +} print " \r\n"; - print "\r\n"; + +if ($timer == -1) +{ +print "\r\n"; +print "\r\n"; +print "\r\n"; +} +else +{ print "\r\n"; print "\r\n"; print "\r\n"; +} + print "\r\n"; print "\r\n"; print "
    \r\n"; diff --git a/javascript/functions.js b/javascript/functions.js index bf32859..a708963 100755 --- a/javascript/functions.js +++ b/javascript/functions.js @@ -157,4 +157,36 @@ function str_pad (input, pad_length, pad_string, pad_type) { } return input; -} +} + +function checkform() +{ + + if ( document.timer.timer_name.value=="" ) + { + alert('Recording name is missing'); + return false; + } + else if ( document.timer.timer_chan.value=="" ) + { + alert('Select a channel to record'); + return false; + } + else if ( document.timer.timer_date.value=="" ) + { + alert('Select recording date'); + return false; + } + else if ( document.timer.timer_starttime.value=="" ) + { + alert('Select recording start time'); + return false; + } + else if ( document.timer.timer_endtime.value=="" ) + { + alert('Select recording end time'); + return false; + } + + return true; +} -- cgit v1.2.3