Just what I needed, Alex ...
Thanks.
Ray
> yes, just read the value in, check its length and then add 0s until its
the
> right length
>
> something like this:
>
> var sNum = oField.text;
> for(i=0;i<(7-sNum.length);i++) sNum = "0" + sNum;
> oField.text = sNum;
>
> -----Original Message-----
> From: Ray Murphy [mailto:raymurphy@g...]
> Sent: 15 August 2001 09:39
> To: javascript
> Subject: [javascript] Padding with Leading Zeroes
>
>
> Hi,
>
> I've got an input field (numeric) on a form, which will eventually be
> passed into a search function where the associated field on the database
> holds up to seven characters. Suppose a value on the database is held as
> '0000197', I don't want to force the user to enter the leading zeroes -
so
> here I'd like to allow the user to enter '197', then have my code pad
the
> value entered by the user to be '0000197' so that value can be passed
down
> to the search function.
>
> Should this be easy to do in Javascript ?
>
>
> Thanks.
>
> Ray