Jump to content

Recommended Posts

  • Administrators
Posted

phpVMS uses jquery, it's included by default and uses it for many things including schedules. So to make it easy, I'd use jquery plugins

Posted

phpVMS uses jquery, it's included by default and uses it for many things including schedules. So to make it easy, I'd use jquery plugins

Pardon my ignorance but if it's already installed do I just need to add the code where I want it?

EX.

<script type="text/javascript">

$(function() {

$("#datepicker").datepicker();

});

</script>

<div class="demo">

<p>Date: <input id="datepicker" type="text"></p>

</div><!-- End demo -->

<div style="display: none;" class="demo-description">

<p>The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.</p>

</div><!-- End demo-description -->

Posted

Ok so I am trying to figure this out I went to the javascript.tpl and saw <script src="lib/js/jquery-1.2.pack.js"></script>

in lib/js there is no 1.2.pack should it be there?

Posted

Nope, it's alreayd included, a newer version. Yes, that demo should work...

Ok, thanks I think I got it figured out now. In my header.tpl I was trying to call an older Jquery that I had installed, I took all the old stuff out of my header and it works now. Just gotta work on the css.

Posted

Ok, thanks I think I got it figured out now. In my header.tpl I was trying to call an older Jquery that I had installed, I took all the old stuff out of my header and it works now. Just gotta work on the css.

What would be the solution for having more than one input that needs a date picker?

<input type="text" id="datepicker">

is there a way to use a class rather than an ID?

Posted

What would be the solution for having more than one input that needs a date picker?

<input type="text" id="datepicker">

is there a way to use a class rather than an ID?

Ok I think I figured away around it I used the from-to script

Not sure if this is a good way to do it, but it works. Sometimes I just need to talk to myself on these forms to get through my problems lol

<script type="text/javascript">

$(function() {

var dates = $('#from, #to').datepicker({

defaultDate: "+1w",

changeMonth: true,

numberOfMonths: 1,

onSelect: function(selectedDate) {

var option = this.id == "from" ? "minDate" : "maxDate";

var instance = $(this).data("datepicker");

var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);

dates.not(this).datepicker("option", option, date);

}

});

});

</script>

Guest N402KC
Posted

Dont use a class when using Inputs, Use ID, Its easier to work with as you will find out.

  • Administrators
Posted

Dont use a class when using Inputs, Use ID, Its easier to work with as you will find out.

No, if you're binding to multiple fields, ALWAYS use a class, you can't have duplicate IDs.

You can do:

<input type="text" class="datepicker" name="..." value="" />

Then the javascript:

$('.datepicker').datepicker({ your options });

The $('.datepicker') picks out any elements with the datepicker class, and applies the datepicker to it. The selector is the same as CSS. Right now you're doing #from, #to which is fine, but you can also use the above if you're using more fields (I think entering more fields in that manually is a bit cumbersome).

Also, if you place any of your optional javascript in your footer (ie, just above the </body> tag), you don't need to have a $(document).ready() call to put them into.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...