close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

datepicker display selected day of week on different area of page

Thread began 8/27/2014 5:56 pm by Jason | Last modified 8/28/2014 3:33 pm by Jason | 3014 views | 9 replies |

Jason

datepicker display selected day of week on different area of page

I'm trying to using datepicker in a form to insert a date in my database formatted as a MySQL date but I also need to display the day of the week for the selected date in a different area of my page. How can I show only the selected day (Monday, Tuesday, etc..) in another area?

Sign in to reply to this post

Jason ByrnesWebAssist

I Don't follow, please provide more details

Sign in to reply to this post

Jason

For example, after selecting a date in the datepicker it displays Thursday, August 28 2014. I want to display "Thursday" after another field in the same form.

Similar to what google calendar does when you are creating a weekly recurring event and you select Wednesday. At the bottom it would say "repeats every week on Wednesday".

Sign in to reply to this post

Jason ByrnesWebAssist

This would require hand coding, I Found an example of this through google here:
http://www.danielmayor.com/jquery-get-day-of-week-from-jquery-ui-datepicker-when-we-select-a-date

but we do not offer support for this through the forum. if you nee help implementing this, I suggest a premiere support appointment:
http://www.webassist.com/premier_request.php

Sign in to reply to this post

Jason ByrnesWebAssist

I Put together a quick example using the linked page:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<link type="text/css" href="webassist/datepicker/untitled1_datepicker_1/jquery-ui.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function(){
$('#datepicker_1').datepicker({
dateFormat: 'mm/dd/yy',
showAnim: 'show',
onSelect: function(dateText){
var seldate = $(this).datepicker('getDate');
seldate = seldate.toDateString();
seldate = seldate.split(' ');
var weekday=new Array();
weekday['Mon']="Monday";
weekday['Tue']="Tuesday";
weekday['Wed']="Wednesday";
weekday['Thu']="Thursday";
weekday['Fri']="Friday";
weekday['Sat']="Saturday";
weekday['Sun']="Sunday";
var dayOfWeek = weekday[seldate[0]];
$('#dayOfWeekSpan').html("You selcted "+dayOfWeek+"");
},
onClose: closeDatePicker_datepicker_1
});
});
function closeDatePicker_datepicker_1() {
var tElm = $('#datepicker_1');
if (typeof datepicker_1_Spry != null && typeof datepicker_1_Spry != "undefined" && test_Spry.validate) {
datepicker_1_Spry.validate();
}
tElm.blur();
}


</script>
</head>

<body>
<input id="datepicker_1" name="test" type="text" />

<span id="dayOfWeekSpan"></span>
</body>
</html>




if you need further help adapting this, please submit a premier support request:
http://www.webassist.com/premier_request.php

Sign in to reply to this post

Jason

Once again YOU DA MAN!! Thanks! That was exactly what I needed.

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Jason

I know I'm pushing my luck here but I have one more question on this thread.

Is it possible to assign a value to the text in the span, and then submit that value with my form?

For example, if "Wednesday" was displayed in the span it would have a hidden value of 3, and 3 would be entered into a specified column of my database when the form was submitted.

I didn't know if something like this would work in the function or not.

var weekday=new Array();
weekday['Mon']="Monday";
weekday['Tue']="Tuesday";
weekday['Wed']="Wednesday" value="0";
weekday['Thu']="Thursday";
weekday['Fri']="Friday";
weekday['Sat']="Saturday";
weekday['Sun']="Sunday";
Sign in to reply to this post

Jason ByrnesWebAssist

that would require further custom coding that is not supported.

please submit a premier support request:
http://www.webassist.com/premier_request.php

Sign in to reply to this post

Jason

Ok, thanks.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...