|
CalendarXP.net Support Most forums here are private and invisible to public.
|
View previous topic :: View next topic |
Author |
Message |
ndorfnz
Joined: 30 Jan 2006 Posts: 6
|
Posted: Mon Jan 30, 2006 3:13 am Post subject: Get me that value selected to use! |
|
|
Love the product, very nice!
Looking for some guidance...
1st off...
Using the following function in plugins.js to format my date output:
Code: | function fFormatInput(y,m,d) {
var str=fFormatDate(y,m,d).split(gsSplit);
//
var d=new Date(y,m-1,d).getDay();
//var wd=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
//
//return wd[d]+", "+str[1]+" "+str[2]+", "+str[0];
return str[1]+" "+str[2]+", "+str[0];
} |
So I get (ie: January 9, 2006)...works just like I want!!
Now I need to submit my form with the value I have selected...
So I looked at the following:
Code: | function fAfterSelected(y,m,d,e)
{
gdCtrl.form.submit();
} |
Now when I added this to my plugins.js, my format now changed to 2006-January-29.
I'd like to keep the previous format, is this possible?
//==============================================
2nd...
Now when utilizing the fAfterSelected function, I need to get the date value and assign it to a variable to run it through a php time() function.
I need to send the value from this php time() function in the 'base' value when the form gets submitted. (see below)
//CHECK IF base time is being sent
Code: | PHP CODE
if (!isset($_GET['base']))
{
$base_time = time();
} else {
//need to assign the value selected in the calendar to a variable
//
$base_time = $_GET['base'];
} |
How do I get this date value to utilize in my existing php while the form is being submitted?
Appreciate the guidance!!!
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Mon Jan 30, 2006 4:46 am Post subject: |
|
|
1st, could you please attach the plugins.js you are using? Because we added the fFormatInput and fAfterSelected functions to the standard normal theme and couldn't reproduce the problem you had - it just works.
2nd, you should use $_POST in place of $_GET in php, because html form submit is by default a POST action. e.g.
Code: | PHP CODE
if (!isset($_POST['base']))
{
$base_time = time();
} else {
$base_time = $_POST['base'];
} |
I personally would suggest using $_REQUEST, since it covers both GET and POST.
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
ndorfnz
Joined: 30 Jan 2006 Posts: 6
|
Posted: Mon Jan 30, 2006 10:34 am Post subject: |
|
|
The plugins.js I am using is from the contrast theme:
It is here:
http://www.ndorfnz.com/calendar/themes/Contrast/plugins.js
Ok, I get the $_POST, my bad. However, this still doesn't explain to me how I get the value that is currently in the calendar selection to run through a php function, then get via the $_POST.
$_POST is expecting the name 'base'.
Here's the deal. The date selected needs to be run through time() to get me the UNIX time. Then using this UNIX time I determine what day it is to establish my Previous and Next links correctly. So when I change the date via the calendar these links to be resynced as well as perform a query against a mysql table.
A sampling is here:
http://www.ndorfnz.com/content/rlogs/weekdisplay.php
You can clearly see I am loading the date correctly using onload now. It is keeping the formatting now (it wasn't before?)
The form is posting, however the value from the date selection needs to used against a function and then query a mysql table. [/code]
|
|
Back to top |
|
|
ndorfnz
Joined: 30 Jan 2006 Posts: 6
|
Posted: Mon Jan 30, 2006 11:18 am Post subject: |
|
|
Well low and behold with some additional debugging I got it to ALMOST work!!!
http://www.ndorfnz.com/content/rlogs/weekdisplay.php
Very slick!!!
However, is the function fAfterSelected only posting the value of the textbox filled from the selection???
I am trying to post other values within the form submitting but they are not appearing? So...is the fAfterSelected function only posting the textbox value???
Thanks for the direction.
|
|
Back to top |
|
|
ndorfnz
Joined: 30 Jan 2006 Posts: 6
|
Posted: Mon Jan 30, 2006 12:20 pm Post subject: |
|
|
Oops! Never mind...got it to work.
Needed to add the other textbox values in hidden textboxes in the actual form...
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group
|