summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/Javascripts/js/validator.js2
-rw-r--r--framework/Web/Javascripts/prado/validation3.js336
-rw-r--r--framework/Web/Services/TPageService.php1
-rw-r--r--framework/Web/UI/TControl.php2
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php12
5 files changed, 176 insertions, 177 deletions
diff --git a/framework/Web/Javascripts/js/validator.js b/framework/Web/Javascripts/js/validator.js
index 41b40fcd..43624d38 100644
--- a/framework/Web/Javascripts/js/validator.js
+++ b/framework/Web/Javascripts/js/validator.js
@@ -139,7 +139,7 @@ return this.trim($F(control));}},observeDatePickerChanges:function()
{checked++;values.push(element.value);}});return{'checks':checked,'values':values};},getListElements:function()
{switch(this.options.ControlType)
{case'TCheckBoxList':case'TRadioButtonList':var elements=[];for(var i=0;i<this.options.TotalItems;i++)
-{var element=$(this.options.ControlToValidate+"_"+i);if(this.isCheckBoxType(element))
+{var element=$(this.options.ControlToValidate+"_c"+i);if(this.isCheckBoxType(element))
elements.push(element);}
return elements;case'TListBox':var elements=[];var element=$(this.options.ControlToValidate);if(element&&(type=element.type.toLowerCase()))
{if(type=="select-one"||type=="select-multiple")
diff --git a/framework/Web/Javascripts/prado/validation3.js b/framework/Web/Javascripts/prado/validation3.js
index 8becac70..ad55f96b 100644
--- a/framework/Web/Javascripts/prado/validation3.js
+++ b/framework/Web/Javascripts/prado/validation3.js
@@ -1,27 +1,27 @@
/**
* Prado client-side javascript validation fascade.
- *
+ *
* There are 4 basic classes, Validation, ValidationManager, ValidationSummary
* and TBaseValidator, that interact together to perform validation.
- * The <tt>Prado.Validation</tt> class co-ordinates together the
+ * The <tt>Prado.Validation</tt> class co-ordinates together the
* validation scheme and is responsible for maintaining references
- * to ValidationManagers.
- *
+ * to ValidationManagers.
+ *
* The ValidationManager class is responsible for maintaining refereneces
* to individual validators, validation summaries and their associated
* groupings.
- *
+ *
* The ValidationSummary take cares of display the validator error messages
- * as html output or an alert output.
- *
+ * as html output or an alert output.
+ *
* The TBaseValidator is the base class for all validators and contains
* methods to interact with the actual inputs, data type conversion.
- *
+ *
* An instance of ValidationManager must be instantiated first for a
* particular form before instantiating validators and summaries.
- *
- * Usage example: adding a required field to a text box input with
+ *
+ * Usage example: adding a required field to a text box input with
* ID "input1" in a form with ID "form1".
* <code>
* <script type="text/javascript" src="../prado.js"></script>
@@ -33,16 +33,16 @@
* <input type="submit text="submit" />
* <script type="text/javascript">
* new Prado.ValidationManager({FormID : 'form1'});
- * var options =
+ * var options =
* {
* ID : 'validator1',
* FormID : 'form1',
- * ErrorMessage : '*',
+ * ErrorMessage : '*',
* ControlToValidate : 'input1'
* }
* new Prado.WebUI.TRequiredFieldValidator(options);
* new Prado.WebUI.TValidationSummary({ID:'summary1',FormID:'form1'});
- *
+ *
* //watch the form onsubmit event, check validators, stop if not valid.
* Event.observe("form1", "submit" function(ev)
* {
@@ -67,10 +67,10 @@ Prado.Validation = Class.create();
Object.extend(Prado.Validation,
{
managers : {},
-
+
/**
- * Validate the validators (those that <strong>DO NOT</strong>
- * belong to a particular group) the form specified by the
+ * Validate the validators (those that <strong>DO NOT</strong>
+ * belong to a particular group) the form specified by the
* <tt>formID</tt> parameter. If <tt>groupID</tt> is specified
* then only validators belonging to that group will be validated.
* @param string ID of the form to validate
@@ -88,7 +88,7 @@ Object.extend(Prado.Validation,
throw new Error("Form '"+form+"' is not registered with Prado.Validation");
}
},
-
+
/**
* @return string first form ID.
*/
@@ -101,7 +101,7 @@ Object.extend(Prado.Validation,
/**
* Check if the validators are valid for a particular form (and group).
* The validators states will not be changed.
- * The <tt>validate</tt> function should be called first.
+ * The <tt>validate</tt> function should be called first.
* @param string ID of the form to validate
* @param string ID of the group to validate.
*/
@@ -111,7 +111,7 @@ Object.extend(Prado.Validation,
return this.managers[formID].isValid(groupID);
return true;
},
-
+
/**
* Add a new validator to a particular form.
* @param string the form that the validator belongs.
@@ -126,7 +126,7 @@ Object.extend(Prado.Validation,
throw new Error("A validation manager for form '"+formID+"' needs to be created first.");
return this.managers[formID];
},
-
+
/**
* Add a new validation summary.
* @param string the form that the validation summary belongs.
@@ -138,14 +138,14 @@ Object.extend(Prado.Validation,
if(this.managers[formID])
this.managers[formID].addSummary(validator);
else
- throw new Error("A validation manager for form '"+formID+"' needs to be created first.");
+ throw new Error("A validation manager for form '"+formID+"' needs to be created first.");
return this.managers[formID];
}
});
Prado.ValidationManager = Class.create();
/**
- * Validation manager instances. Manages validators for a particular
+ * Validation manager instances. Manages validators for a particular
* HTML form. The manager contains references to all the validators
* summaries, and their groupings for a particular form.
* Generally, <tt>Prado.Validation</tt> methods should be called rather
@@ -157,7 +157,7 @@ Prado.ValidationManager.prototype =
summaries : [], // validation summaries
groups : [], // validation groups
options : {},
-
+
/**
* <code>
* options['FormID']* The ID of HTML form to manage.
@@ -168,7 +168,7 @@ Prado.ValidationManager.prototype =
this.options = options;
Prado.Validation.managers[options.FormID] = this;
},
-
+
/**
* Validate the validators managed by this validation manager.
* @param string only validate validators belonging to a group (optional)
@@ -180,12 +180,12 @@ Prado.ValidationManager.prototype =
if(group)
return this._validateGroup(group, invoker);
else
- return this._validateNonGroup(invoker);
+ return this._validateNonGroup(invoker);
},
-
+
/**
* Validate a particular group of validators.
- * @param string ID of the form
+ * @param string ID of the form
* @param HTMLElement element that calls for validation
* @return boolean false if group is not valid, true otherwise.
*/
@@ -205,7 +205,7 @@ Prado.ValidationManager.prototype =
this.updateSummary(groupID, true);
return valid;
},
-
+
/**
* Validate validators that doesn't belong to any group.
* @return boolean false if not valid, true otherwise.
@@ -224,7 +224,7 @@ Prado.ValidationManager.prototype =
this.updateSummary(null, true);
return valid;
},
-
+
/**
* Gets the state of all the validators, true if they are all valid.
* @return boolean true if the validators are valid.
@@ -236,7 +236,7 @@ Prado.ValidationManager.prototype =
else
return this._isValidNonGroup();
},
-
+
/**
* @return boolean true if all validators not belonging to a group are valid.
*/
@@ -246,11 +246,11 @@ Prado.ValidationManager.prototype =
this.validators.each(function(validator)
{
if(!validator.group)
- valid = valid & validator.isValid;
+ valid = valid & validator.isValid;
});
return valid;
},
-
+
/**
* @return boolean true if all validators belonging to the group are valid.
*/
@@ -262,12 +262,12 @@ Prado.ValidationManager.prototype =
this.validators.each(function(validator)
{
if(validator.group == groupID)
- valid = valid & validator.isValid;
+ valid = valid & validator.isValid;
});
- }
+ }
return valid;
},
-
+
/**
* Add a validator to this manager.
* @param Prado.WebUI.TBaseValidator a new validator
@@ -278,7 +278,7 @@ Prado.ValidationManager.prototype =
if(validator.group && !this.groups.include(validator.group))
this.groups.push(validator.group);
},
-
+
/**
* Add a validation summary.
* @param Prado.WebUI.TValidationSummary validation summary.
@@ -287,7 +287,7 @@ Prado.ValidationManager.prototype =
{
this.summaries.push(summary);
},
-
+
/**
* Gets all validators that belong to a group or that the validator
* group is null and the validator validation was false.
@@ -304,7 +304,7 @@ Prado.ValidationManager.prototype =
});
return validators;
},
-
+
/**
* Update the summary of a particular group.
* @param string validation group to update.
@@ -327,8 +327,8 @@ Prado.ValidationManager.prototype =
/**
* TValidationSummary displays a summary of validation errors inline on a Web page,
* in a message box, or both. By default, a validation summary will collect
- * <tt>ErrorMessage</tt> of all failed validators on the page. If
- * <tt>ValidationGroup</tt> is not empty, only those validators who belong
+ * <tt>ErrorMessage</tt> of all failed validators on the page. If
+ * <tt>ValidationGroup</tt> is not empty, only those validators who belong
* to the group will show their error messages in the summary.
*
* The summary can be displayed as a list, as a bulleted list, or as a single
@@ -337,16 +337,16 @@ Prado.ValidationManager.prototype =
*
* The summary can be displayed on the Web page and in a message box by setting
* the <tt>ShowSummary</tt> and <tt>ShowMessageBox</tt>
- * options, respectively.
+ * options, respectively.
*/
Prado.WebUI.TValidationSummary = Class.create();
-Prado.WebUI.TValidationSummary.prototype =
+Prado.WebUI.TValidationSummary.prototype =
{
- group : null,
+ group : null,
options : {},
visible : false,
messages : null,
-
+
/**
* <code>
* options['ID']* Validation summary ID, i.e., an HTML element ID
@@ -360,7 +360,7 @@ Prado.WebUI.TValidationSummary.prototype =
* options['Display'] Display mode, 'None', 'Static', 'Dynamic'.
* options['ScrollToSummary'] True to scroll to the validation summary upon refresh.
* </code>
- */
+ */
initialize : function(options)
{
this.options = options;
@@ -370,7 +370,7 @@ Prado.WebUI.TValidationSummary.prototype =
this.visible = this.visible && this.messages.style.display != "none";
Prado.Validation.addSummary(options.FormID, this);
},
-
+
/**
* Update the validation summary to show the error message from
* validators that failed validation.
@@ -389,23 +389,23 @@ Prado.WebUI.TValidationSummary.prototype =
}
var refresh = update || this.visible == false || this.options.Refresh != false;
-
+
if(this.options.ShowSummary != false && refresh)
{
this.updateHTMLMessages(this.getMessages(validators));
this.showSummary(validators);
}
-
+
if(this.options.ScrollToSummary != false)
window.scrollTo(this.messages.offsetLeft-20, this.messages.offsetTop-20);
-
+
if(this.options.ShowMessageBox == true && refresh)
{
this.alertMessages(this.getMessages(validators));
this.visible = true;
}
},
-
+
/**
* Display the validator error messages as inline HTML.
*/
@@ -413,9 +413,9 @@ Prado.WebUI.TValidationSummary.prototype =
{
while(this.messages.childNodes.length > 0)
this.messages.removeChild(this.messages.lastChild);
- new Insertion.Bottom(this.messages, this.formatSummary(messages));
+ new Insertion.Bottom(this.messages, this.formatSummary(messages));
},
-
+
/**
* Display the validator error messages as an alert box.
*/
@@ -424,7 +424,7 @@ Prado.WebUI.TValidationSummary.prototype =
var text = this.formatMessageBox(messages);
setTimeout(function(){ alert(text); },20);
},
-
+
/**
* @return array list of validator error messages.
*/
@@ -432,14 +432,14 @@ Prado.WebUI.TValidationSummary.prototype =
{
var messages = [];
validators.each(function(validator)
- {
- var message = validator.getErrorMessage();
+ {
+ var message = validator.getErrorMessage();
if(typeof(message) == 'string' && message.length > 0)
messages.push(message);
})
- return messages;
- },
-
+ return messages;
+ },
+
/**
* Hides the validation summary.
*/
@@ -457,7 +457,7 @@ Prado.WebUI.TValidationSummary.prototype =
}
this.visible = false;
},
-
+
/**
* Shows the validation summary.
*/
@@ -470,7 +470,7 @@ Prado.WebUI.TValidationSummary.prototype =
this.messages.show();
this.visible = true;
},
-
+
/**
* Return the format parameters for the summary.
* @param string format type, "List", "SingleParagraph" or "BulletList"
@@ -502,7 +502,7 @@ Prado.WebUI.TValidationSummary.prototype =
output += format.first;
messages.each(function(message)
{
- output += message.length > 0 ? format.pre + message + format.post : "";
+ output += message.length > 0 ? format.pre + message + format.post : "";
});
// for(var i = 0; i < messages.length; i++)
// output += (messages[i].length>0) ? format.pre + messages[i] + format.post : "";
@@ -540,24 +540,24 @@ Prado.WebUI.TValidationSummary.prototype =
/**
* TBaseValidator serves as the base class for validator controls.
*
- * Validation is performed when a postback control, such as a TButton,
- * a TLinkButton or a TTextBox (under AutoPostBack mode) is submitting
+ * Validation is performed when a postback control, such as a TButton,
+ * a TLinkButton or a TTextBox (under AutoPostBack mode) is submitting
* the page and its <tt>CausesValidation</tt> option is true.
* The input control to be validated is specified by <tt>ControlToValidate</tt>
* option.
*/
Prado.WebUI.TBaseValidator = Class.create();
-Prado.WebUI.TBaseValidator.prototype =
+Prado.WebUI.TBaseValidator.prototype =
{
- enabled : true,
+ enabled : true,
visible : false,
- isValid : true,
+ isValid : true,
options : {},
_isObserving : {},
group : null,
manager : null,
message : null,
-
+
/**
* <code>
* options['ID']* Validator ID, e.g. span with message
@@ -580,15 +580,15 @@ Prado.WebUI.TBaseValidator.prototype =
/* options.OnValidate = options.OnValidate || Prototype.emptyFunction;
options.OnSuccess = options.OnSuccess || Prototype.emptyFunction;
options.OnError = options.OnError || Prototype.emptyFunction;
- */
+ */
this.options = options;
this.control = $(options.ControlToValidate);
this.message = $(options.ID);
this.group = options.ValidationGroup;
-
+
this.manager = Prado.Validation.addValidator(options.FormID, this);
},
-
+
/**
* @return string validation error message.
*/
@@ -598,8 +598,8 @@ Prado.WebUI.TBaseValidator.prototype =
},
/**
- * Update the validator span, input CSS class, and focus particular
- * element. Updating the validator control will set the validator
+ * Update the validator span, input CSS class, and focus particular
+ * element. Updating the validator control will set the validator
* <tt>visible</tt> property to true.
*/
updateControl: function()
@@ -610,18 +610,18 @@ Prado.WebUI.TBaseValidator.prototype =
this.isValid ? this.message.hide() : this.message.show();
this.message.style.visibility = this.isValid ? "hidden" : "visible";
}
-
+
if(this.control)
- this.updateControlCssClass(this.control, this.isValid);
-
+ this.updateControlCssClass(this.control, this.isValid);
+
if(this.options.FocusOnError && !this.isValid)
Prado.Element.focus(this.options.FocusElementID);
-
+
this.visible = true;
},
-
+
/**
- * Add a css class to the input control if validator is invalid,
+ * Add a css class to the input control if validator is invalid,
* removes the css class if valid.
* @param object html control element
* @param boolean true to remove the css class, false to add.
@@ -635,9 +635,9 @@ Prado.WebUI.TBaseValidator.prototype =
control.removeClassName(CssClass);
else
control.addClassName(CssClass);
- }
+ }
},
-
+
/**
* Hides the validator messages and remove any validation changes.
*/
@@ -661,14 +661,14 @@ Prado.WebUI.TBaseValidator.prototype =
if(this.enabled)
this.isValid = this.evaluateIsValid();
-
+
if(this.isValid)
{
if(typeof(this.options.OnSuccess) == "function")
{
this.visible = true;
this.message.style.visibility = "visible";
- this.updateControlCssClass(this.control, this.isValid);
+ this.updateControlCssClass(this.control, this.isValid);
this.options.OnSuccess(this, invoker);
}
else
@@ -678,20 +678,20 @@ Prado.WebUI.TBaseValidator.prototype =
{
if(typeof(this.options.OnError) == "function")
{
- this.visible = true;
- this.message.style.visibility = "visible";
+ this.visible = true;
+ this.message.style.visibility = "visible";
this.updateControlCssClass(this.control, this.isValid);
this.options.OnError(this, invoker);
}
else
this.updateControl();
}
-
+
this.observeChanges(this.control);
-
+
return this.isValid;
},
-
+
/**
* Observe changes to the control input, re-validate upon change. If
* the validator is not visible, no updates are propagated.
@@ -700,14 +700,14 @@ Prado.WebUI.TBaseValidator.prototype =
observeChanges : function(control)
{
if(!control) return;
-
+
var canObserveChanges = this.options.ObserveChanges != false;
var currentlyObserving = this._isObserving[control.id+this.options.ID];
if(canObserveChanges && !currentlyObserving)
{
var validator = this;
-
+
Event.observe(control, 'change', function()
{
if(validator.visible)
@@ -719,7 +719,7 @@ Prado.WebUI.TBaseValidator.prototype =
this._isObserving[control.id+this.options.ID] = true;
}
},
-
+
/**
* @return string trims the string value, empty string if value is not string.
*/
@@ -727,7 +727,7 @@ Prado.WebUI.TBaseValidator.prototype =
{
return typeof(value) == "string" ? value.trim() : "";
},
-
+
/**
* Convert the value to a specific data type.
* @param {string} the data type, "Integer", "Double", "Date" or "String"
@@ -751,18 +751,18 @@ Prado.WebUI.TBaseValidator.prototype =
return value;
else
{
- var value = string.toDate(this.options.DateFormat);
+ var value = string.toDate(this.options.DateFormat);
if(value && typeof(value.getTime) == "function")
return value.getTime();
else
return null;
}
case "String":
- return string.toString();
+ return string.toString();
}
return value;
},
-
+
/**
* @return mixed control value to validate
*/
@@ -778,7 +778,7 @@ Prado.WebUI.TBaseValidator.prototype =
else
{
this.observeDatePickerChanges();
-
+
return Prado.WebUI.TDatePicker.getDropDownDate(control).getTime();
}
case 'THtmlArea':
@@ -787,12 +787,12 @@ Prado.WebUI.TBaseValidator.prototype =
return this.trim($F(control));
default:
if(this.isListControlType())
- return this.getFirstSelectedListValue();
+ return this.getFirstSelectedListValue();
else
return this.trim($F(control));
}
},
-
+
/**
* Observe changes in the drop down list date picker, IE only.
*/
@@ -806,7 +806,7 @@ Prado.WebUI.TBaseValidator.prototype =
this.observeChanges(DatePicker.getYearListControl(this.control));
}
},
-
+
/**
* Gets numeber selections and their values.
* @return object returns selected values in <tt>values</tt> property
@@ -826,8 +826,8 @@ Prado.WebUI.TBaseValidator.prototype =
}
});
return {'checks' : checked, 'values' : values};
- },
-
+ },
+
/**
* Gets an array of the list control item input elements, for TCheckBoxList
* checkbox inputs are returned, for TListBox HTML option elements are returned.
@@ -841,7 +841,7 @@ Prado.WebUI.TBaseValidator.prototype =
var elements = [];
for(var i = 0; i < this.options.TotalItems; i++)
{
- var element = $(this.options.ControlToValidate+"_"+i);
+ var element = $(this.options.ControlToValidate+"_c"+i);
if(this.isCheckBoxType(element))
elements.push(element);
}
@@ -850,7 +850,7 @@ Prado.WebUI.TBaseValidator.prototype =
var elements = [];
var element = $(this.options.ControlToValidate);
if(element && (type = element.type.toLowerCase()))
- {
+ {
if(type == "select-one" || type == "select-multiple")
elements = $A(element.options);
}
@@ -859,7 +859,7 @@ Prado.WebUI.TBaseValidator.prototype =
return [];
}
},
-
+
/**
* @return boolean true if element is of checkbox or radio type.
*/
@@ -872,7 +872,7 @@ Prado.WebUI.TBaseValidator.prototype =
}
return false;
},
-
+
/**
* @return boolean true if control to validate is of some of the TListControl type.
*/
@@ -881,7 +881,7 @@ Prado.WebUI.TBaseValidator.prototype =
var list = ['TCheckBoxList', 'TRadioButtonList', 'TListBox'];
return list.include(this.options.ControlType);
},
-
+
/**
* @return string gets the first selected list value, initial value if none found.
*/
@@ -889,8 +889,8 @@ Prado.WebUI.TBaseValidator.prototype =
{
var initial = "";
if(typeof(this.options.InitialValue) != "undefined")
- initial = this.options.InitialValue;
- var elements = this.getListElements();
+ initial = this.options.InitialValue;
+ var elements = this.getListElements();
var selection = this.getSelectedValuesAndChecks(elements, initial);
return selection.values.length > 0 ? selection.values[0] : initial;
}
@@ -905,7 +905,7 @@ Prado.WebUI.TBaseValidator.prototype =
* options['InitialValue'] Validation fails if control input equals initial value.
* </code>
*/
-Prado.WebUI.TRequiredFieldValidator = Class.extend(Prado.WebUI.TBaseValidator,
+Prado.WebUI.TRequiredFieldValidator = Class.extend(Prado.WebUI.TBaseValidator,
{
/**
* @return boolean true if the input value is not empty nor equal to the initial value.
@@ -948,7 +948,7 @@ Prado.WebUI.TRequiredFieldValidator = Class.extend(Prado.WebUI.TBaseValidator,
* to perform. Valid operators include Equal, NotEqual, GreaterThan, GreaterThanEqual,
* LessThan and LessThanEqual.
* <code>
- * options['ControlToCompare']
+ * options['ControlToCompare']
* options['ValueToCompare']
* options['Operator']
* options['Type']
@@ -958,14 +958,14 @@ Prado.WebUI.TRequiredFieldValidator = Class.extend(Prado.WebUI.TBaseValidator,
Prado.WebUI.TCompareValidator = Class.extend(Prado.WebUI.TBaseValidator,
{
//_observingComparee : false,
-
+
/**
* Compares the input to another input or a given value.
*/
evaluateIsValid : function()
{
var value = this.getValidationValue();
- if (value.length <= 0)
+ if (value.length <= 0)
return true;
var comparee = $(this.options.ControlToCompare);
@@ -973,23 +973,23 @@ Prado.WebUI.TCompareValidator = Class.extend(Prado.WebUI.TBaseValidator,
if(comparee)
var compareTo = this.getValidationValue(comparee);
else
- var compareTo = this.options.ValueToCompare || "";
-
+ var compareTo = this.options.ValueToCompare || "";
+
var isValid = this.compare(value, compareTo);
-
+
if(comparee)
{
- this.updateControlCssClass(comparee, isValid);
+ this.updateControlCssClass(comparee, isValid);
this.observeChanges(comparee);
- }
- return isValid;
+ }
+ return isValid;
},
-
+
/**
* Compares two values, their values are casted to type defined
- * by <tt>DataType</tt> option. False is returned if the first
+ * by <tt>DataType</tt> option. False is returned if the first
* operand converts to null. Returns true if the second operand
- * converts to null. The comparision is done based on the
+ * converts to null. The comparision is done based on the
* <tt>Operator</tt> option.
*/
compare : function(operand1, operand2)
@@ -999,7 +999,7 @@ Prado.WebUI.TCompareValidator = Class.extend(Prado.WebUI.TBaseValidator,
return false;
if ((op2 = this.convert(this.options.DataType, operand2)) == null)
return true;
- switch (this.options.Operator)
+ switch (this.options.Operator)
{
case "NotEqual":
return (op1 != op2);
@@ -1018,9 +1018,9 @@ Prado.WebUI.TCompareValidator = Class.extend(Prado.WebUI.TBaseValidator,
});
/**
- * TCustomValidator performs user-defined client-side validation on an
+ * TCustomValidator performs user-defined client-side validation on an
* input component.
- *
+ *
* To create a client-side validation function, add the client-side
* validation javascript function to the page template.
* The function should have the following signature:
@@ -1065,8 +1065,8 @@ Prado.WebUI.TCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,
* TRangeValidator tests whether an input value is within a specified range.
*
* TRangeValidator uses three key properties to perform its validation.
- * The <tt>MinValue</tt> and <tt>MaxValue</tt> options specify the minimum
- * and maximum values of the valid range. The <tt>DataType</tt> option is
+ * The <tt>MinValue</tt> and <tt>MaxValue</tt> options specify the minimum
+ * and maximum values of the valid range. The <tt>DataType</tt> option is
* used to specify the data type of the value and the minimum and maximum range values.
* These values are converted to this data type before the validation
* operation is performed. The following value types are supported:
@@ -1074,7 +1074,7 @@ Prado.WebUI.TCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,
* - <b>Float</b> A double-precision floating point number data type.
* - <b>Date</b> A date data type. The date format can be specified by
* setting <tt>DateFormat</tt> option, which must be recognizable
- * by <tt>Date.SimpleParse</tt> javascript function.
+ * by <tt>Date.SimpleParse</tt> javascript function.
* - <b>String</b> A string data type.
* <code>
* options['MinValue'] Minimum range value
@@ -1093,19 +1093,19 @@ Prado.WebUI.TRangeValidator = Class.extend(Prado.WebUI.TBaseValidator,
{
var value = this.getValidationValue();
if(value.length <= 0)
- return true;
+ return true;
if(typeof(this.options.DataType) == "undefined")
this.options.DataType = "String";
-
+
var min = this.convert(this.options.DataType, this.options.MinValue || null);
var max = this.convert(this.options.DataType, this.options.MaxValue || null);
value = this.convert(this.options.DataType, value);
-
+
if(value == null)
return false;
-
+
var valid = true;
-
+
if(min != null)
valid = valid && value >= min;
if(max != null)
@@ -1129,9 +1129,9 @@ Prado.WebUI.TRegularExpressionValidator = Class.extend(Prado.WebUI.TBaseValidato
evaluateIsValid : function()
{
var value = this.getValidationValue();
- if (value.length <= 0)
+ if (value.length <= 0)
return true;
-
+
var rx = new RegExp(this.options.ValidationExpression);
var matches = rx.exec(value);
return (matches != null && value == matches[0]);
@@ -1147,7 +1147,7 @@ Prado.WebUI.TEmailAddressValidator = Prado.WebUI.TRegularExpressionValidator;
/**
* TListControlValidator checks the number of selection and their values
- * for a TListControl that allows multiple selections.
+ * for a TListControl that allows multiple selections.
*/
Prado.WebUI.TListControlValidator = Class.extend(Prado.WebUI.TBaseValidator,
{
@@ -1160,13 +1160,13 @@ Prado.WebUI.TListControlValidator = Class.extend(Prado.WebUI.TBaseValidator,
var elements = this.getListElements();
if(elements && elements.length <= 0)
return true;
-
+
this.observeListElements(elements);
-
+
var selection = this.getSelectedValuesAndChecks(elements);
return this.isValidList(selection.checks, selection.values);
},
-
+
/**
* Observe list elements for IE browsers of changes
*/
@@ -1179,19 +1179,19 @@ Prado.WebUI.TListControlValidator = Class.extend(Prado.WebUI.TBaseValidator,
{
validator.observeChanges(element);
});
- }
+ }
},
-
+
/**
* Determine if the number of checked and the checked values
- * satisfy the required number of checks and/or the checked values
+ * satisfy the required number of checks and/or the checked values
* equal to the required values.
* @return boolean true if checked values and number of checks are satisfied.
*/
isValidList : function(checked, values)
- {
+ {
var exists = true;
-
+
//check the required values
var required = this.getRequiredValues();
if(required.length > 0)
@@ -1200,17 +1200,17 @@ Prado.WebUI.TListControlValidator = Class.extend(Prado.WebUI.TBaseValidator,
return false;
required.each(function(requiredValue)
{
- exists = exists && values.include(requiredValue);
+ exists = exists && values.include(requiredValue);
});
}
-
- var min = typeof(this.options.Min) == "undefined" ?
+
+ var min = typeof(this.options.Min) == "undefined" ?
Number.NEGATIVE_INFINITY : this.options.Min;
- var max = typeof(this.options.Max) == "undefined" ?
+ var max = typeof(this.options.Max) == "undefined" ?
Number.POSITIVE_INFINITY : this.options.Max;
return exists && checked >= min && checked <= max;
},
-
+
/**
* @return array list of required options that must be selected.
*/
@@ -1224,25 +1224,25 @@ Prado.WebUI.TListControlValidator = Class.extend(Prado.WebUI.TBaseValidator,
});
-/**
- * TDataTypeValidator verifies if the input data is of the type specified
- * by <tt>DataType</tt> option.
- * The following data types are supported:
- * - <b>Integer</b> A 32-bit signed integer data type.
- * - <b>Float</b> A double-precision floating point number data type.
- * - <b>Date</b> A date data type.
- * - <b>String</b> A string data type.
- * For <b>Date</b> type, the option <tt>DateFormat</tt>
- * will be used to determine how to parse the date string.
- */
-Prado.WebUI.TDataTypeValidator = Class.extend(Prado.WebUI.TBaseValidator,
-{
- evaluateIsValid : function()
- {
- var value = this.getValidationValue();
- if(value.length <= 0)
- return true;
- return this.convert(this.options.DataType, value) != null;
- }
-});
+/**
+ * TDataTypeValidator verifies if the input data is of the type specified
+ * by <tt>DataType</tt> option.
+ * The following data types are supported:
+ * - <b>Integer</b> A 32-bit signed integer data type.
+ * - <b>Float</b> A double-precision floating point number data type.
+ * - <b>Date</b> A date data type.
+ * - <b>String</b> A string data type.
+ * For <b>Date</b> type, the option <tt>DateFormat</tt>
+ * will be used to determine how to parse the date string.
+ */
+Prado.WebUI.TDataTypeValidator = Class.extend(Prado.WebUI.TBaseValidator,
+{
+ evaluateIsValid : function()
+ {
+ var value = this.getValidationValue();
+ if(value.length <= 0)
+ return true;
+ return this.convert(this.options.DataType, value) != null;
+ }
+});
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index 54112fb1..af2ddce3 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -264,7 +264,6 @@ class TPageService extends TService
{
$configCached=false;
$paths=explode('.',$pagePath);
- array_pop($paths);
$configPath=$this->getBasePath();
foreach($paths as $path)
{
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 7ca37a00..1aabb2a5 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -73,7 +73,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
/**
* format of control ID
*/
- const ID_FORMAT='/^\\w*$/';
+ const ID_FORMAT='/^[a-zA-Z_]\\w*$/';
/**
* separator char between IDs in a UniqueID
*/
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index de332897..2a16673c 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -62,7 +62,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
parent::__construct();
$this->_repeatedControl=$this->createRepeatedControl();
$this->_repeatedControl->setEnableViewState(false);
- $this->_repeatedControl->setID('0');
+ $this->_repeatedControl->setID('c0');
$this->getControls()->add($this->_repeatedControl);
}
@@ -282,7 +282,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$repeatedControl->getAttributes()->copyFrom($item->getAttributes());
else if($repeatedControl->getHasAttributes())
$repeatedControl->getAttributes()->clear();
- $repeatedControl->setID("$index");
+ $repeatedControl->setID("c$index");
$repeatedControl->setText($item->getText());
$repeatedControl->setChecked($item->getSelected());
$repeatedControl->setAttribute('value',$item->getValue());
@@ -301,7 +301,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
{
if($this->getEnabled(true))
{
- $index=(int)substr($key,strlen($this->getUniqueID())+1);
+ $index=(int)substr($key,strlen($this->getUniqueID())+2);
$this->ensureDataBound();
if($index>=0 && $index<$this->getItemCount())
{
@@ -353,7 +353,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$n=$this->getItemCount();
for($i=0;$i<$n;++$i)
{
- $this->_repeatedControl->setID("$i");
+ $this->_repeatedControl->setID("c$i");
$page->registerRequiresPostData($this->_repeatedControl);
}
}
@@ -381,7 +381,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$this->setTabIndex($tabIndex);
}
}
-
+
/**
* Returns the value to be validated.
* This methid is required by IValidatable interface.
@@ -390,7 +390,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
public function getValidationPropertyValue()
{
return $this->getSelectedValue();
- }
+ }
}
?> \ No newline at end of file