Hi, I have created a custom SharePoint 2010 web part using a scheduler with some custom attributes. Everything is working fine except for validation of the custom attributes on the advanced edit/insert form. There are two text boxes which should not be empty and save should not allow the advanced form to be saved back to the SP list.
I have the following code in the FormCreated event:
RadScheduler scheduler = (RadScheduler)sender;
CustomValidator validatorForAttributePhone =
new
CustomValidator();
validatorForAttributePhone.ValidationGroup = scheduler.ValidationGroup;
validatorForAttributePhone.ControlToValidate =
"AttrPhone"
;
validatorForAttributePhone.ErrorMessage =
"Cannot be blank!"
;
validatorForAttributePhone.ClientValidationFunction =
"validationFunctionPhone"
;
(e.Container.FindControl(
"AttrPhone"
)
as
RadTextBox).Parent.Controls.Add(validatorForAttributePhone);
And the jsavascript function is
function
validationFunctionPhone(source, arguments)
{
i
f
(arguments.Value.length != 0)
{
arguments.IsValid =
true
; }
else
{arguments.IsValid =
false
;
}}
All the validation seems to be created OK but this never fires when the 'Save' button is clicked on the advanced edit/insert form which means that the appointment can be saved when there is no text in the phone field on the form.
What am I missing?
Thanks,
Jonathan