thefrozencoder

Programming and Technology blog

TinyMCE, ASP.NET and validation

The following describes how to use a custom validator function along side TinyMCE to validate the contents of the textarea.

Add the custom validator and setup the properties as you normally setting the ControlToValidate to the ID of the textarea and the ClientValidationFunction to the function name you see below (this can be changed of course).

The key is to call TinyMCE's triggerSave() method so the editor can synch up to the underlying textarea. Once this is done the textarea now has content.

<script language="JavaScript" type="text/javascript">
function validateTinyMCEText(source, args) {   
var txt = document.getElementById(source.controltovalidate);
tinyMCE.triggerSave();
args.Value = (txt.value.replace(/^W+/,'')).replace(/W+$/,'');
args.IsValid = (args.Value != '');}
</script>

Hopefully this will help out a few people

IE8 available as a VPC Image

The new IE8 beta was released yesterday and is available as a Virtual PC hard drive from Microsoft. You can download the following hard drive images from this location.

  • XP SP2 w/IE6
  • XP SP2 w/IE7
  • XP SP2 w/IE8
  • Vista w/IE7

You can also check out the IE Blog for more information on what kind of changes will be implemented. The big news is CSS 2.1 compliance, get the VPC image and start testing your sites.

Hang on boys and girls it’s going to be an interesting ride...