jQuery Timepicker Addon from Trent Richardson. Two issues.
Hi,
I'm still a newby when it comes to jQuery so excuse my lack of knowledge.
The story is this:
- I get the time from the webserver (code behind)
- I format the time (code behind)
- I save it to a asp:hiddenfield called start_time (code behind)
- I add an hour and save it as another asp:hiddenfield called end_time (code behind)
- I display the start_time value as my default input value for the start_time_picker time picker <= first issue
- If needed, I click the input box and select another time <= second issue
I do not include the code behind because it's working just fine.
Here is the jQuery code:
- <script type="text/javascript">
- $(document).ready(
- function () {
- document.getElementById('start_time_picker').value = document.getElementById("start_time").value;
- var startTimeTextBox = $('#start_time_picker');
- var endTimeTextBox = $('#end_time_picker');
- $.timepicker.timeRange(
- startTimeTextBox,
- endTimeTextBox,
- {
- minInterval: (1000 * 60 * 60), // 1hr
- timeFormat: 'HH:mm',
- controlType: 'select',
- oneLine: true,
- start: { // start picker options
- onSelect: function (datetimeText, datepickerInstance) {
- document.getElementById("start_time").value = datetimeText ;
- }
- },
- end: { // end picker options
- onSelect: function (datetimeText, datepickerInstance) {
- document.getElementById("end_time").value = endtimeText;
- }
- }
- }
- );
- });
- </script>
As such, everything is working (code wise) but I'm having display issues.
Problem 1: setting the value to start_time input
When the page loads, I have the picker panel visible for some reason:
If I comment line 4, the start_time_picker is obviously blank but the picker panel is not displayed.
No idea why that is!?
Problem 2: When clicking an input to pick a time, the background is transparent
Like this:
Looks to me as if there is a css related issue, no?
Here is the style information:
- <link href="../css/jquery-ui-timepicker-addon.css" rel="stylesheet" />
- <style rel="stylesheet" type="text/css">
- /*-------------------------------*/
- /*Body and HTML supported classes*/
- /*-------------------------------*/
- body {
- font-family: Verdana, Helvetica, sans-serif;
- font-size: 11px;
- height: 100%;
- min-height: 100%;
- }
- html {
- height: 100%;
- min-height: 100%;
- width: 100%; /* Full width and height */
- margin: 0px; /* No space between browser edge and content */
- padding: 0px;
- }
- * {
- margin: 0px;
- padding: 0px;
- font-family: inherit;
- font-style: inherit;
- font-size: 100%;
- }
- #start_time_picker {
- width: 50px;
- }
- #end_time_picker {
- width: 50px;
- }
- </style>
Any help would be MUCH appreciated.