So the script at the bottom is the function for the filter. All I want is for a datepicker to assign a date when it is ''picked'' to the chosenDate part of the filter.
And here is the datepicker:
Code:
<p><label for="dp-1">Demo 1</label> : <input type="text" class="w16em" id="dp-1" name="dp-1" value="13/03/2009" /></p>
<script type="text/javascript">
// <![CDATA[
var opts = {
// Attach input with an id of "dp-1" and give it a "d-sl-m-sl-Y" date format (e.g. 13/03/1990)
formElements:{"dp-1":"d-sl-m-sl-Y"}
};
datePickerController.createDatePicker(opts);
// ]]>
</script>
Its nothing to do with the ID because that was just what was on the demo of where I got the date-picker from.
Obviously it means that you should enter the form ID if you've got one but I need the date to be entered into a script, this one:
Code:
<script>
var chosenDate = '2012-09-04';
function checkDate(rgn, doIt) {
if (doIt('{dsDates::datebooked}') == chosenDate) {
Spry.Utils.addClassName('id'+doIt('{dsArtists::@id}'),'hidden');
}
}
</script>
the ''var chosenDate = '2012-09-04' needs to be connected to the datepicker as this is where the dataset find out which of the artists are available on that date. So when you click on the URL you'll find that 4 artists come up out of a possible five, the fifth being not available on that particular date.
Ahhh...you are going to have to ask this in a Spry forum, I think. Maybe somebody here knows.
In order to make this work, you are going to have to tell Spry to layout the page *AGAIN*, using the newly picked date. So presumably the datepicker code will have to be tied into the Spry code in such a way that when a new date is picked the appropriate Spry code is then invoked.
On top of that, you will probably need to handle an onchange even on the text field, in case a user opts to simply change the date by hand instead of using the date picker.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Ok thanks anyway. But is there no way of connecting the datepicker to the ''var chosenDate = '2012-09-04' '' part of the script. I don't see why I'll have to do anything more to the Spry because you could manually change the date above and it would alter the results depending on what date you put.
So all that needs to be done is the date in: var chosenDate = '2012-09-04' be changed to what date is 'chosen' in the datepicker.
I wouldn't have thought it would be anything to do with spry but just some JavaScript.
Not sure I've fully understood the requirement, but maybe:
Code:
var opts = {
// Attach input with an id of "dp-1" and give it a "d-sl-m-sl-Y" date format (e.g. 13/03/1990)
formElements:{"dp-1":"d-sl-m-sl-Y"},
// Stipulate some callback functions
callbackFunctions: {
"dateset": [yourFunction] // for change to both input and datepicker
// or "datereturned" for just the input
}
};
datePickerController.createDatePicker(opts);
function yourFunction() {
chosenDate = document.getElementById("dp-1").value;
}
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS