The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Datepicker & JQuery
#1
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!
  Reply
#2
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>
  Reply
#3
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!
  Reply
#4
Awesome! And let me know if you need any more help.
  Reply
#5
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!
  Reply
#6
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
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)