Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Business Open and Close hours for each day of the week - how best to structure in the database using ASP and javascript

Posted on 2013-01-27
1
Medium Priority
?
322 Views
Last Modified: 2013-05-08
I'll be using this code for a timepicker so businesses can select their hours of business for each day of the week:

<input name="time" value="" />
<script type="text/javascript">
    $(document).ready(function(){
        $('input[name="time"]').ptTimeSelect();
    });
</script>

Open in new window


I need to know the best way to structure this in the ClientAdverts table: i.e. how best to store the business opening and closing hours from Monday - Sunday.

Can this be done in one field? E.g. An 'OpenHours' field containing all the open and close times from Monday - Sunday for each business listing?

The the data will need to be listed separately/vertically for each day of the week, e.g:

Monday: 08.30 - 17.30
Tuesday: 08.30 - 17.30
Sunday: Closed

Etc.

Some help and suggestions would be great.
0
Comment
Question by:UName10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 38824478
The only difference between this

<input name="time" value="" />

and this

<input name="time" value="" />
<script type="text/javascript">
    $(document).ready(function(){
        $('input[name="time"]').ptTimeSelect();
    });
</script>

is the second version creates the  popup.  

Think of the javascript as this

<%
for each input with name = "time"
     make a cool pop up when the user clicks the field
next
%>

Knowing that, I would change

$('input[name="time"]').ptTimeSelect(); to

to

$('.timepicker').ptTimeSelect();

Now you have

<%
for each input that has a class of timepicker
     make a cool pop up when the user clicks the field
next
%>

and that one piece of javascript will work if you have multiple fields that need the pop up like below regardless of the ID or name.

<input name="time" class="timepicker" value="" />
<input name="time2" class="timepicker" value="" />
<input name="time3" class="timepicker" value="" />
<input name="time4" class="timepicker" value="" />
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question