From 10af3a5dacc91c3e53320795ff43bafe57707599 Mon Sep 17 00:00:00 2001 From: David Hicks Date: Fri, 15 Jul 2011 23:48:45 +1000 Subject: [PATCH] Use placeholder attribute for stopwatch input fields As part of issue #11826 to remove all inline JavaScript, the time tracking stopwatch feature was rewritten using jQuery. A default value of "hh:mm" was being placed in the time tracking input field which is invalid if submitted. We should be using the newer 'placeholder' HTML attribute instead of mangling the actual value stored in the text input field. --- bug_change_status_page.php | 2 +- bugnote_add_inc.php | 4 ++-- javascript/common.js | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bug_change_status_page.php b/bug_change_status_page.php index 25bc3aec1b..1c32c59fa1 100644 --- a/bug_change_status_page.php +++ b/bug_change_status_page.php @@ -362,7 +362,7 @@ - + diff --git a/bugnote_add_inc.php b/bugnote_add_inc.php index f4f7a07f82..82c68f0b52 100644 --- a/bugnote_add_inc.php +++ b/bugnote_add_inc.php @@ -104,11 +104,11 @@ - + - + diff --git a/javascript/common.js b/javascript/common.js index f99d072331..b27fc3b26d 100644 --- a/javascript/common.js +++ b/javascript/common.js @@ -130,13 +130,13 @@ $(document).ready( function() { if (hours < 10) { hours = '0' + hours; } - $('input[type=text].stopwatch_time').attr('value', hours + ':' + minutes + ':' + seconds); + $('input[type=text].stopwatch_time').val(hours + ':' + minutes + ':' + seconds); this.start(); }, reset: function() { this.stop(); this.elapsedTime = 0; - $('input[type=text].stopwatch_time').attr('value', '00:00:00'); + $('input[type=text].stopwatch_time').val(''); }, start: function() { this.stop(); @@ -156,18 +156,18 @@ $(document).ready( function() { if (stopwatch.elapsedTime == 0) { stopwatch.stop(); stopwatch.start(); - $('input[type=button].stopwatch_toggle').attr('value', translations['time_tracking_stopwatch_stop']); + $('input[type=button].stopwatch_toggle').val(translations['time_tracking_stopwatch_stop']); } else if (typeof stopwatch.timerID == 'number') { stopwatch.stop(); - $('input[type=button].stopwatch_toggle').attr('value', translations['time_tracking_stopwatch_start']); + $('input[type=button].stopwatch_toggle').val(translations['time_tracking_stopwatch_start']); } else { stopwatch.start(); - $('input[type=button].stopwatch_toggle').attr('value', translations['time_tracking_stopwatch_stop']); + $('input[type=button].stopwatch_toggle').val(translations['time_tracking_stopwatch_stop']); } }); $('input[type=button].stopwatch_reset').click(function() { stopwatch.reset(); - $('input[type=button].stopwatch_toggle').attr('value', translations['time_tracking_stopwatch_start']); + $('input[type=button].stopwatch_toggle').val(translations['time_tracking_stopwatch_start']); }); $('input[type=text].datetime').each(function(index, element) {