• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

List box with time intervals as its options

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!

In my project I have to design a form such that the List item in the form will have time intervals starting from 00:00HRS to 23:55HRS as its options with an interval of every 5 minutes. I am confused how to do it. Searched so many sites but didn't get an answer. Can anyone help me out how I can do this using JSP's.

Please reply soon as I am in urgent need of it...

 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wouldn't this just be HTML form input? Something like...

If you're looking for something more than this, please provide additional information. (I would move this to the HTML forum, but I'm not sure I understand what you're asking.)
 
Sree Mami
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marc

U are right! I have to do the same. But inserting so many options into a list box is too tedious so can u tell me any easy way to achieve it..

 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a job for two nested for loops to me - one for the hours, one for the minutes.
 
Sree Mami
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone give me an idea how to achieve this task using JSP. I tried using two for loops but I am not getting
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sree Mami:
Can anyone give me an idea how to achieve this task using JSP. I tried using two for loops but I am not getting


What exactly have you tried?

(Are you sure you want a single list of 288 options? Or might it be better to have a list of 24 options for the hour, and a separate list of 12 options for the minutes? My guess is that most users would be annoyed by that long list.)
 
Sree Mami
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marc

Actually I need to have those options showing every 5 minutes interval as some processing in our project are dealt even considering minutes for a specific task. Anyways I succeded in doing that.

My code is:

<select name="starttime" accesskey="R" tabindex="9" style="width:90"><option></option>
<%
int shr=0,smin=0;
for(shr=0;shr<24;shr++)
{
if(shr<24)
{
for(smin=0;smin<=60; )
{
if(smin==60)
{smin=0;break;}
if(shr<12)
time=shr+":"+smin+"AM";
else
time=shr+":"+smin+"PM";

System.out.println(time);
%>
<option value='<%=time%>'><%=time%><%
smin=smin+5;
}
}
}
%></option>
</select>

Any modifications to this code is appreciated...

Thank u
[ July 17, 2006: Message edited by: Sree Mami ]
 
Sree Mami
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Happy to see the response of Ilja Preuss and I really got how to deal with my task easily, otherwise I am totally confused thinking what to do!
reply
    Bookmark Topic Watch Topic
  • New Topic