customvalidator added via renderform.ascx has issues.
I've created a custom compare validator to compare the text of two text boxes (in separate naming containers) added in the normal way through the contour form admin screens, basically a email and confirm email scenario that I need to check.
All seems to work. Up to the point of hitting submit the submit button.
By that I mean the clientside evaluation works and says the text in the two textboxes isn't the same.
By leaving another mandatory field blank so that the form doesn't submit, clicking the submit button my customvalidator clientside evaluation then doesn't fire.
Also if I complete the form apart from the textfields not matching and hit submit the form submits... even thought the EvaluateIsValid() server side validation on the customvalidator will be failing.
All I can think is that on the submit button click you are manipulating the page.validators collection in order to hook up your Umbraco.Forms.Core.Controls.Validation.ValidationFieldExtenderBehavior???
So my questions is
Are you removing items and re-adding only your own validators to the page.validators collection? are you doing this both for client and server side validations?
If this is the case is there a way I can use the Umbraco.Forms.Core.Controls.Validation.ValidationFieldExtender to include my validator to the collection which would be nice as it would then pick up the jquery extensions you use to indicate erroring validation fields.....
thanks...
(contour 1.1.3, umb 4.5.2, iis7, windows server 2008)
that seems to solved that one.. I had based on some code from the farm, that used form.name as the validationgroup maybe that was for an older incarnation of contour.
customvalidator added via renderform.ascx has issues.
I've created a custom compare validator to compare the text of two text boxes (in separate naming containers) added in the normal way through the contour form admin screens, basically a email and confirm email scenario that I need to check.
All seems to work. Up to the point of hitting submit the submit button.
By that I mean the clientside evaluation works and says the text in the two textboxes isn't the same.
By leaving another mandatory field blank so that the form doesn't submit, clicking the submit button my customvalidator clientside evaluation then doesn't fire.
Also if I complete the form apart from the textfields not matching and hit submit the form submits... even thought the EvaluateIsValid() server side validation on the customvalidator will be failing.
All I can think is that on the submit button click you are manipulating the page.validators collection in order to hook up your Umbraco.Forms.Core.Controls.Validation.ValidationFieldExtenderBehavior???
So my questions is
Are you removing items and re-adding only your own validators to the page.validators collection? are you doing this both for client and server side validations?
If this is the case is there a way I can use the Umbraco.Forms.Core.Controls.Validation.ValidationFieldExtender to include my validator to the collection which would be nice as it would then pick up the jquery extensions you use to indicate erroring validation fields.....
thanks...
(contour 1.1.3, umb 4.5.2, iis7, windows server 2008)
so managed to figure out how to use the validationextender...
Control ctrlLab = FindLabelRecursive(rpFieldsets, fieldId.Replace('-', '_'));
//compareValidator
UmbracoJPT.Contour.Validators.compare2Textboxes compareValidator = (UmbracoJPT.Contour.Validators.compare2Textboxes)FindControlRecursive(ctrlLab.Parent, "compare");
string compareTo = fields.Find(x => x.Caption == compareCtrl).Id.ToString();
Control validate = FindControlRecursive(rpFieldsets, fieldId.Replace('-', '_'));
Control compare = FindControlRecursive(rpFieldsets, compareTo.Replace('-', '_'));
Umbraco.Forms.Core.Controls.Validation.ValidationFieldExtender compareExtender = new Umbraco.Forms.Core.Controls.Validation.ValidationFieldExtender();
compareExtender.TargetLabelID = ctrlLab.UniqueID;
compareExtender.TargetControlID = compareValidator.UniqueID;
compareExtender.InvalidLabelCssClass = "contourError";
compareExtender.InvalidTextBoxCssClass = "contourError";
compareExtender.ValidLabelCssClass = "contourValid";
compareExtender.ValidTextBoxCssClass = "contourValid";
validate.Parent.Controls.Add(compareExtender);
so now just need to find out how to hook into the submit button click....
Comment author was deleted
Hi Mike,
I guess it's just a matter of setting the correct validation group on your compare validator
It needs to be set to the clientid of the RenderForm control
that seems to solved that one.. I had based on some code from the farm, that used form.name as the validationgroup maybe that was for an older incarnation of contour.
is working on a reply...