Saturday, March 24, 2012

Wizard Control, UpdatePanel, and Validation causes error in webresource.axd Bug

I have a wizard control with several steps, some of which use control validation. When placed inside an Ajax UpdatePanel, the webresource.axd javascript is no longer able to reference the controls validated in the previous step, and halts on:

WebResource.axdfunction ValidatorGetValue(id) { var control; control = document.getElementById(id); if (typeof(control.value) == "string") { return control.value; } return ValidatorGetValueRecursive(control);}

where the document.getElementById(id); returns null.

A workaround is to disable clientside validation on all validation controls, which is not a great loss when using ajax, but utterly annoying when you have gone to all the trouble of writing javascript for custom validation controls, etc.

The cause is probably complex, so I shall not comment on how it should be resolved. I assume, however, that the javascript is correct in that the controls not being rendered are in fact to be found in the DOM.

At least in my case, it would be nice if the javascript checked for null and ignored the control if it wasn't there.

Anyhow, it would be much appreciated if someone would look into it.

Thanks

In Atlas 1.0 we have updated versions of the validators that are compatible with UpdatePanel. In the current CTP I'm afraid that you'll have to use some workaround.

Thanks,

Eilon


This sounds like it could be related to my problem:

http://forums.asp.net/thread/1412888.aspx

What work arounds are available for this issue? At the moment I'm displaying all the controls in divs and just hiding them, which is pretty horrible.

Thanks,

Paul

No comments:

Post a Comment