p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

flash_programming thread: RE: flash_programming digest: May 15, 2001

Message #1 by "Michael Evans" <mike@s...> on Wed, 16 May 2001 00:03:26 -0400

You could always use the string object to validate variables before passing
// parse before submitting variable to ASP
if (text.length > 11) {
	check = "Invalid, too many characters.";
} else if (text.length < 11) {
	check = "Invalid, too few characters.";

// you could also chop the extra characters
text = text.slice (0,11);

where "text" is whatever variable you're passing.  Keep in mind that the
string object index starts at 0 like arrays.

You also can set the "Max Chars." field in the text pallet to limit the
number of characters.  If you only embed numbers on your font options, your
user will only be able to enter numbers.

hope that helped.

//Subject: Text Field Validation in Flash
//From: "Lalit Chanchlani" <lalit@x...>

//Hi All,

//I have a text field, the contents of which thru an ASP page gets stored 
//in the database. Now my concern is that I want to validate that field so 
//that a user can enter only 12 digits i.e. if he enters less than  12 
//digits and preses enter it should give a message "Invalid" .. the 
//greater one that is not more than 12 digits is the Restrict option in 
//Propertoies of field. And also the user if enters any non-numerical 
//value should throw an error.

//Please help.

//Thanks and Best Regards

  Return to Index