Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Restricting input by MaskEdit in IE / Firefox

, 5 Nov 2006 CPOL
To provide a better user experience using MaskEdit, a textbox with restrictions, auot-trim box, and tip box, supports IE/Firefox.


function OnPageLoad()
{    
    InitializeTrimBox();    
    
    InitializeTextbox( "txtAcceptNonnegativeIntegerBox", InputType.NonnegativeInteger);
    InitializeTextbox( "txtAcceptWholeNumberBox", InputType.WholeNumber);
    InitializeTextbox( "txtAcceptCurrencyBox", InputType.Currency);
        
    InitializeMaskEdit( "txtPostalCode", "$A$d$A $d$A$d");
	InitializeMaskEdit( "txtTelPhone", "($d$d$d)$d$d$d-$d$d$d$d");
	InitializeMaskEdit( "txtCarNumber", "$$A*$d$d$d$d$d");
	InitializeMaskEdit( "txtDateTime1", "$d$d$d$d-$d$d-$d$d");
	InitializeMaskEdit( "txtDateTime2", "$d$d/$d$d/$d$d$d$d");
	
	InitializeTipBox( "txtTipBox", "If you do not change the password, left blank.");
}



// the first parameter is the XmlHttp parameter
// the sencond parameter is the custom parameter
function CallbackFunction(ajax)
{
    var objDoc = ajax.GetXmlDoc();
    //alert(objDoc.childNodes[0].nodeName );
    alert(ajax.GetResponse());
    //alert(ajax.GetCustomParam());
    
    //alert( objDom.selectSingleNode( "//xmlRoot/a" ).text );
   
    //alert(xmlHttp.responseText);
    //alert(xmlHttp.responseXML.xml);
    //alert(xmlHttp.status);
    //alert(xmlHttp.statusText);
    
    
}


function TestAjax()
{
    var ajax = new AJAX( GetAbsoluteUrl(".\\test.xml") );
    ajax.SetCallbackFun(CallbackFunction);
    ajax.SetCustomParam("Customer Parameter");
    ajax.AddUrlParameter( "Type", 1);
    ajax.AddUrlParameter( "Name", "Jerry");
    ajax.AddUrlParameter( "Card", "@#@@#=");
    ajax.Send(null);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jerry.Wang
Team Leader
China China
Jerry is from China. He was captivated by computer programming since 13 years old when first time played with Q-Basic.
 

  • Windows / Linux & C++
  • iOS & Obj-C
  • .Net & C#
  • Flex/Flash & ActionScript
  • HTML / CSS / Javascript
  • Gaming Server programming / video, audio processing / image & graphics
 
Contact: vcer(at)qq.com
Chinese Blog: http://blog.csdn.net/wangjia184

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 6 Nov 2006
Article Copyright 2006 by Jerry.Wang
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid