The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Datepicker & JQuery - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Documentation (https://userspice.com/forums/forumdisplay.php?fid=30)
+--- Thread: Datepicker & JQuery (/showthread.php?tid=390)



Datepicker & JQuery - marciocaparica - 12-14-2016

Hello! I've discovered Userspice recently (about 2 weeks ago) and have had a great time working on a intranet system for the school I work at.

I'm at a point now in which I need to create a form in which the user will two dates... I've been trying to make various datepicker options I found through Google work, all of them bootstrap-related, but none seem to work.

I'd like to know, is there a proper way to add jquery to the pages I create with Userspice? What is it? It seems JQuery isn't loaded by default, and we must load it adding a call to the jquery file that's included in the install, am I right?

Any suggestions of a good datepicker plug-in that could be easily added to my project?

Thank you very much

M!


Datepicker & JQuery - mudmin - 12-14-2016

jQuery is loaded by default...every once in a while I have some sort of oddness with it.

I use this one and put the css in the users/css folder and js in the users/js folder.
http://trentrichardson.com/examples/timepicker

I can't remember if I HAVE to include jQuery UI, so it would be (at the top of the page)
Code:
<link rel="stylesheet" href="users/js/jquery-ui.min.css">
Code:
<link rel="stylesheet" href="users/js/timepicker.css">

At the bottom (in the scripts section)
Code:
<script src="users/js/external/jquery/jquery.js"></script>
Code:
<script src="users/js/jquery-ui.min.js"></script>
Code:
<script src="users/js/timepicker.js"></script>
Code:
<script>
<pre>
Code:
$('#check_in').datetimepicker({
  dateFormat: "yy-mm-dd"
});
</pre>


<pre>
Code:
$('#check_out').datetimepicker({
  dateFormat: "yy-mm-dd"
});
</pre>


Code:
</script>

Then you need to make sure that your date and time are formatted properly and in the same way as the db. A typical form form input would be...

Code:
<div class="form-group">
Code:
<label for="name">Check Out*</label>
Code:
<input type="text" class="form-control" name="check_out" id="check_out"
Code:
value="<?php if(!empty($_POST)){echo Input::get('check_out');}?>"required>
Code:
</div>



Datepicker & JQuery - marciocaparica - 12-14-2016

Great, I'll try it and let you know if it worked!

Once again, thank you for putting Userspice out in the world, it was exactly what I needed, and the additional classes made my life so much easier. :-)

All the best

M!


Datepicker & JQuery - mudmin - 12-14-2016

Awesome! And let me know if you need any more help.


Datepicker & JQuery - Brandin - 02-02-2017

I'm trying to use a datepicker where the only day you can select is Saturday. I am epicly failing tho!

I have added the requested above with the exceptions to the timepicker.

Any assistance would be great!


Datepicker & JQuery - mudmin - 02-03-2017

I'm horrendous at javascript. I use this one...http://trentrichardson.com/examples/timepicker/

They have options to set specific times, etc. I would imagine if you asked, he could tell you how to limit dates.

The other option I can think of would be to ask at stack overflow