CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I submit (autopost) the form right after a date is picked (onchange)?

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> CalendarXP F.A.Q.
View previous topic :: View next topic  
Author Message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Tue Feb 15, 2005 6:34 pm    Post subject: How can I submit (autopost) the form right after a date is picked (onchange)? Reply with quote

To submit a static form named as "testForm", you may use the following code in plugins.js:
Code:
function fAfterSelected(y,m,d) {
  gContainer.document.testForm.submit();
}

For PopCalendarXP, it could be even simpler (you don't have to know the name of the form):
Code:
function fAfterSelected(y,m,d) {
  gdCtrl.form.submit();
}

If you are working with ASP.NET with client validators disabled, you could replace the above function with the following one:
Code:
function fAfterSelected(y,m,d) {
  if (gdCtrl.onchange) gdCtrl.onchange();
}

This way the authentic ASP.NET event handler will be called after a date is picked via the PopCalendar so as to maintain a consistent AutoPostBack behavior.

NOTE:
Unfortunately, we found a bug in the WebUIValidation.js provided by ASP.NET 1.x that will cause an error if the client validators are turned on.

To fix it, you need to patch the WebUIValidation.js under \Inetpub\wwwroot\aspnet_client directory.
1st, find the ValidatorOnChange function and replace it with following one:
Code:
function ValidatorOnChange(el) {
    var vals = el.Validators;
    var i;
    for (i = 0; i < vals.length; i++) {
        ValidatorValidate(vals[i]);
    }
    ValidatorUpdateIsValid();   
}

2nd, find the following string:
Code:
var func = new Function("ValidatorOnChange(); " + ev);
and replace it with
Code:
var func = new Function("ValidatorOnChange(this); " + ev);
Now, the error should be gone.

However, this patch solution won't work in ASP.NET 2.0, because the WebUIValidation.js is now dynamically generated with that bug buried deep in its engine. We don't know when Microsoft will fix it, so we'd suggest turning off the onchange ASP.NET validator on the date field totally. It shouldn't affect your form's validity, because the date picked via the calendar is always in a good format.

Finally, please note that this is a common issue that affects every javascript product on the market, not just PopCalendarXP.

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> CalendarXP F.A.Q. All times are GMT
Page 1 of 1

 
Jump to:  
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