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
309 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 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

718 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