Jump to content

Timepicker variables


Kay1021

Recommended Posts

I am using this mootools time picker on my site http://www.consideropen.com/blog/2008/07/mootime-mootools-12-javascript-timepicker/#comment-5594...i already have a date picker...and i have it so once you have chosen the date and click outside the pop up calendar that the information will be sent to the database. I did this by using this bit of code in the javascript file

var url = 'page.php?cat_ID=' + this.input.get('id') + '&date=' + this.input.get('value');
	var request = new Request({
		url:url,
		method:'POST'//,
		//onRequest: function() {
		//	alert('making ajax call :: ' + url);
		//}
	}).send();

 

So it would send the variables I needed back to my page.php and there i could insert into the database. Works fine....but now i am attempting to do this with the time picker....this one is a little different set up....but i'm having trouble trying to find the right variables to use

this.input.get('value')
doesn't work and i can't find the right combination. I was hoping someone might be able to help me.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/197424-timepicker-variables/
Share on other sites

With Javascript "this: references which object is calling the function. So if you call:

 

<input type="text" onBlur="javascript:callFunction(this)">

 

Your function would be set to accept the this variable:

 

function CallFunction(element)

{

ajaxTime(this.value);

}

 

Should send the contents of the text box to an ajax function.  Is this what you wanted to do?

var newChosenTime = hour + ':'  + min + minTwo + amPm;
  Sounds suspicious.

 

found in:

//grabs the current selected time and pushes it into the value property of the mootime input field
var chosenTime = function() {
	//gets time from the timechooser display
	var hour = $(createMootime).getElement('.display_hour').get('text');
	var min =  $(createMootime).getElement('.display_min').get('text');
	var minTwo =  $(createMootime).getElement('.display_mintwo').get('text');
	var amPm =  $(createMootime).getElement('.display_ampm').get('text');
	var newChosenTime = hour + ':'  + min + minTwo + amPm;

	//sets the mootime input field to the time on the timechooser
	$(timepickerInput).setProperty('value', newChosenTime);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.