function ValidationFunction1(source, args) {
alert('test');
var controlId = document.getElementById(source.controltovalidate).id;
var control = $("#" + controlId);
var value = control.val();
var is_valid = value != "";
is_valid ? control.removeClass("error") : control.addClass("error");
args.IsValid = is_valid;
}
When I test the form on the localhost everything works fine. But when I build the solution and include it into umbraco the customvalidation doesn't work.
I used Page.Validate(); if (Page.IsValid) on the submit click action in the code behind but that doesn't have any effect.
I found differtent solutions but none of them works.
What version of Umbraco are you using? Just asking to figure out whether it could be an issue with Webforms since Umbraco 7 for instance runs MVC by default. So it's pretty important to know in order for people to provide qualified answers :)
I just add the entire project to a folder on the umbraco server. I excluded the folder with the umbracoReservedPaths and the project is working fine. But when I add the usercontrol into Umbraco it doesn't. I stripped out every other code so the only thing left is the usercontrol, but it still doesn't work.
The problem is caused by the macro. I put the usercontrol directly into the template and it works :):
Custom validation won't fire in usercontrol
Hi,
I have a problem with a form. I build a form with the following code:
The script 'validationfunction1':
When I test the form on the localhost everything works fine. But when I build the solution and include it into umbraco the customvalidation doesn't work.
I used Page.Validate(); if (Page.IsValid) on the submit click action in the code behind but that doesn't have any effect.
I found differtent solutions but none of them works.
Any help would be appreciated.
Best regards, Rik
Hi Rik
What version of Umbraco are you using? Just asking to figure out whether it could be an issue with Webforms since Umbraco 7 for instance runs MVC by default. So it's pretty important to know in order for people to provide qualified answers :)
/Jan
Hi Jan,
Thanks for your reply.
I'm using Umbraco 7 and set webforms as default during the installation. I don't use MVC.
Best regards, Rik
I just add the entire project to a folder on the umbraco server. I excluded the folder with the umbracoReservedPaths and the project is working fine. But when I add the usercontrol into Umbraco it doesn't. I stripped out every other code so the only thing left is the usercontrol, but it still doesn't work.
The problem is caused by the macro. I put the usercontrol directly into the template and it works :):
<%@ Register Src="Vil-samba.ascx" TagPrefix="uc1" TagName="Vilsamba" %>
<uc1:Vilsamba runat="server" id="Vilsamba" />
How can it be that it doesn't work with the macro? And how can I get it to work?
Any ideas?
Best regards, Rik
is working on a reply...