AJAX and validators 
November 21st, 2008, 04:35 PM
| | | |
Hi,
I have a page using AJAX. The page has three modal popups that work fine when I don't have field validators in place.
As soon as I put a validator in place, the popup "form" the validator is part of still works, but the click events (postback) of the other popups is stopped.
So, I have two data entry forms I want to validate, each within their own modal Popup panels.
The system detects the user type accessing the page and this determines which of the two entry forms to display, so only one will be used by a particular user at any time (e.g. normal user, or privileged user).
I also have a delete confirmation (OK or Cancel) modal popup, which is common to both user types.
When I place any validation on one of the entry forms, it stops the OK button postback click event of the delete confirmation from firing.
I also have to click the page twice to get navigation (e.g. date movement), which doesn't happen when the validations controls are removed.
I can probably resolve this by using server side validation, but I'd like to make the client app as responsive as possible.
I suspect that the Delete confirmation's OK button is causing the validators to trigger, but as these are not applicable (and in fact not even visible due to being in a different popup panel), the form appears to not be reacting.
Is there a trick to allowing separate buttons to postback even when validators are on the page but not applicable?
Thanks
Alec | 
November 21st, 2008, 04:45 PM
| | | | re: AJAX and validators
popup panels are not seperate forms. they are part of the page. only their
display is controlled by javascript. a submit will cause all validators to
run whether they in a popup or not. you can use validation group names, and
give the validators in popup panel its own group. if you disable
causesvalidation on a button, it will not perform a client validation. use
this when needed.
-- bruce (sqlwork.com)
"Alec MacLean" wrote: Quote:
Hi,
>
I have a page using AJAX. The page has three modal popups that work fine when I don't have field validators in place.
>
As soon as I put a validator in place, the popup "form" the validator is part of still works, but the click events (postback) of the other popups is stopped.
>
So, I have two data entry forms I want to validate, each within their own modal Popup panels.
>
The system detects the user type accessing the page and this determines which of the two entry forms to display, so only one will be used by a particular user at any time (e.g. normal user, or privileged user).
>
I also have a delete confirmation (OK or Cancel) modal popup, which is common to both user types.
>
When I place any validation on one of the entry forms, it stops the OK button postback click event of the delete confirmation from firing.
>
I also have to click the page twice to get navigation (e.g. date movement), which doesn't happen when the validations controls are removed.
>
I can probably resolve this by using server side validation, but I'd like to make the client app as responsive as possible.
>
I suspect that the Delete confirmation's OK button is causing the validators to trigger, but as these are not applicable (and in fact not even visible due to being in a different popup panel), the form appears to not be reacting.
>
Is there a trick to allowing separate buttons to postback even when validators are on the page but not applicable?
>
Thanks
>
Alec
| | 
November 21st, 2008, 05:35 PM
| | | | re: AJAX and validators
Thanks Bruce - that's helped me a great deal.
Al
"bruce barker" <brucebarker@discussions.microsoft.comwrote in message
news:EBB66418-45AD-4786-890A-18459F88573F@microsoft.com... Quote:
popup panels are not seperate forms. they are part of the page. only their
display is controlled by javascript. a submit will cause all validators to
run whether they in a popup or not. you can use validation group names,
and
give the validators in popup panel its own group. if you disable
causesvalidation on a button, it will not perform a client validation. use
this when needed.
>
-- bruce (sqlwork.com)
>
| |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|