Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: [flasher] Re: VALIDATING INPUTTED TEXT
From: Ian Richardson
Date: Tue, 27 Feb 2001 13:50:31 -0000

Cheers Manuel, but where do i put it and how do i use it?



on 26/2/2001 11:21 AM, Manuel S.-Harguindey at harguinatretemail [dot] es wrote:

> Hello, this little code tests if string is a number and, if so, it
> converts it to a two-decimal-digits number:
>
> // put whatever as the string.
> string = "3ytr4.665";
> num = Number(string);
> valid = !isNaN(string);
> if (valid) {
> // converts to xxx.xx
> num = Math.floor(100*num)/100;
> trace (string+" is a valid number.... .Converted: "+num);
> } else {
> trace (string+" is not a valid number.");
> }
>
> I dont know if it helps...
> Manuel.
>
> Ian Richardson escribió:
>
>> How can i ensure that the data entered into text fields by a user is
>> numerical only? ie they only enter a price
>>
>> Also, after a calculation, how do i ensure that the result only shows 2
>> decimal places.. as in a currency?
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> The Chinwag site carries a wealth of Flash resources.
>> Find useful links, suggested reading and archives at:
>>
>> ** http://www.chinwag.com/flasher **
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> You are subscribed to flasher as: harguinatretemail [dot] es
>> To unsubscribe, email leave-flasher-479602Oatlists [dot] chinwag [dot] com
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> The Chinwag site carries a wealth of Flash resources.
> Find useful links, suggested reading and archives at:
>
> ** http://www.chinwag.com/flasher **
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> You are subscribed to flasher as: irattheconsultancy [dot] co [dot] uk
> To unsubscribe, email leave-flasher-479602Oatlists [dot] chinwag [dot] com
>




[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]