Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: update database after selecting date
jgc
Newbie

Posts: 1
Registered: 4/2/2011
Member Is Offline
posted on 4/3/2011 at 05:31 AM Reply With Quote
update database after selecting date


if you have an onChange event handler on the text box associated with the calendar (e.g., to save the selected date in a database) you will find that inserting the date in the text box with the calendar won't fire the event.

But you can call the handler in the calendar script (calendar_us.js)

Look in the script for this section (it's where the script writes the selected date to the associated text box):

function f_tcalHide (n_date) {
if (n_date)
this.e_input.value = this.f_generDate(new Date(n_date));

and add your code at the end of this function.

For example, I changed the code at the beginning of the function to this:

function f_tcalHide (n_date) {
var newdate = 0;
if (n_date) {
newdate = this.f_generDate(new Date(n_date));
this.e_input.value = newdate;
}

and then, at the end of the function, added something like this:

if (newdate != 0)
if (document.frmFormname)
updateTablename('displayname',this.e_input.id,recordid,'fieldname',newdate);

Here this.e_input.id is the id of the div containing the calendar-associated text box, and newdate is of course the date the user selected using the calendar. frmFormname is the form the calendar text box is in and UpdateTablename is a Javascript function that calls a php page to update a record in a database table using AJAX. But it could be any processing that you need to do with the selected date, including code that limits selected dates to future dates.

(the forum doesn't show it but I do indent the contents of ifs.)
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Tigra Calendar
Product Demonstrations Live Demos
Free Download Free Download
Product Documentation Documentation
Support Forum Support Forum
 
Tigra Calendar PRO
Product Demonstrations Live Demos
Popup Calendar
Onpage Calendar
Modal Calendar
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004