Rabbits don't follow orders

On April 29, 2007, in Meanderings, by Mitch Milam

My friend Bruce W. dropped off some supplies at my house this evening and when I went out to get them, I found one of my highly-trained attack rabbits setting on the front lawn.

"Attack," I ordered.  But, it just set there like a brown, furry, lawn ornament.

I guess I should have believed the guy at the attack rabbit training school….

 

If you've ever tried to close a browser window from ASP.NET by using the following code:

 

<input type="button" class="inputfields"
 onclick="javascript:window.close();" value="Close" /></td>

You will probably receive the following message:

 

After digging around for 20 minutes or so, I finally found the answer on Anatoly Lubarsky's blog:

 

<input type="button" class="inputfields"
onclick="javascript:window.opener='x';window.close();" value="Close" /></td>
 

I am working on a project this weekend ( yeah, I know ) where I will be creating a folder in the file system based on the Account Name for an Account within CRM.  Since it is possible to have characters within an Account Name that would be invalid in a file or folder name, they must be replaced.

The following JavaScript snippet will replace any invalid character within the Account Name with an underscore. 

// Create a dummy account name for testing purposes.
crmForm.all.name.DataValue = "this?is/\ a* test";

if (crmForm.all.name != null)
{
	// The replaceChar should be either a space
	// or an underscore.
	var replaceChar = "_";
	var regEx = new RegExp('[,/\:*?""<>|]', 'g');
	var Filename = crmForm.all.name.DataValue.replace(regEx, replaceChar);

	// Show me the new file name.
	alert(Filename);
}