Hi -
does anyone know how to make the confirmbutton extender conditionnal on the validation of the page?
For instance, i've got a button with confirm extender that posts information entered in TextBoxes. Some of those textboxes have validators - so the post won't happen if the textboxes aren't correctly filled in (so i don't need an active confirmation in that case). If the boxes are correctly filled in, then i would like the confirmButtonExtender to be active...
Anyway to make that happen?
thanks for the help!
-bash
I believe this would take some additional code in ConfirmButtonBehavior.js. If you happen to implement the feature, we'd love to include it in the Toolkit! //
// Custom methods
//ADD this bold text to this function and recompile control toolkit tool - this will first validate the page then display the confirmation dialog
_onClick : function(e) {
if (this.get_element() && !this.get_element().disabled) {
// Display confirm dialog and return result to allow cancellation
if(Page_ClientValidate()) {
if (!window.confirm(this._ConfirmTextValue)) {
e.preventDefault();
return false;
}
}
}
},
this is *.js - i have forgot to put rest code - here it is
PART ONE
_onClick :
function(e) {if (this.get_element() && !this.get_element().disabled) {// Display confirm dialog and return result to allow cancellationif(this._checkValidatorsValue)
{
if(Page_ClientValidate()) {if (!window.confirm(this._ConfirmTextValue)) {
e.preventDefault();
returnfalse;}
}
}
else{
if (!window.confirm(this._ConfirmTextValue)) {e.preventDefault();
returnfalse;}
}
}
},
//// Property get/set methods//get_ConfirmText :
function() {returnthis._ConfirmTextValue;},
set_ConfirmText :
function(value) {if (this._ConfirmTextValue != value) {this._ConfirmTextValue = value;this.raisePropertyChanged('ConfirmText');}
},
get_checkValidators :
function() {returnthis._checkValidatorsValue;},
set_checkValidators :
function(value) {if (this._checkValidatorsValue != value) {this._checkValidatorsValue = value;this.raisePropertyChanged('checkValidators');}
}
PART TWO - add this to this file *.cs
[
ExtenderControlProperty()]publicbool checkValidators{
get{
return GetPropertyBoolValue("checkValidators");}
set{
SetPropertyBoolValue(
"checkValidators",value);}
}
PART THREE
NOW IF YOU WANT TO USE CONFIRM DIALOG WITH VALIDATORS YOU SHOUL SET IN ASPX FILE IN CONFIRMBUTTONEXTANDER PROPERTY CHECKVALIDATORS TO TRUE
IF YOU WANT TO USE CONFIRM DIALOG WITHOUT VALIDATORS (FOR EXAMPLE ON PAGE THERE ARE NOT VALIDATORS) SET THIS PROPERTY TO FALSE
Related to my reply inthis thread, I believe. The code here seems to be a move along the path to add the mentioned submit event support to ConfirmButton.
FYI, I've just fixed this issue:http://www.codeplex.com/WorkItem/View.aspx?ProjectName=AtlasControlToolkit&WorkItemId=8342.
No comments:
Post a Comment