Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Substring a value for display and concatenate for validation? (http://www.velocityreviews.com/forums/t923269-substring-a-value-for-display-and-concatenate-for-validation.html)

Kermit Piper 02-28-2006 06:01 AM

Substring a value for display and concatenate for validation?
 
Hello,

I have a validation script for upc codes which is currently working for
values that are entered into one text box. I've been asked to break up
the text box into 3 separate fields to accept the 1st digit, middle 10
digits, then last check digit. What I'm doing is substringing the
initial values then concatenating them. What I'm not sure of is, how to
handle the validation. I was previously firing an onBlur after the text
box but now that I have three, and I need the values to concatenate
into one for the validation. Should I just fire a function after the
3rd field that concatenates the 3 values, then pass that value to the
validation function? Or is there a better way?

I was also wondering if there was something I could find like an input
mask, but something that could just "overlay" on top of a regular text
box with one value which could give the appearance of having
separations for certain digits, in this case the first and last. Hope
this all makes sense and someone can help. I would sure appreciate any
help at all.

Thanks,
KP


Stephen Chalmers 02-28-2006 03:03 PM

Re: Substring a value for display and concatenate for validation?
 

Kermit Piper wrote:
> Hello,
>
> I have a validation script for upc codes which is currently working for
> values that are entered into one text box. I've been asked to break up
> the text box into 3 separate fields to accept the 1st digit, middle 10
> digits, then last check digit. What I'm doing is substringing the
> initial values then concatenating them. What I'm not sure of is, how to
> handle the validation. I was previously firing an onBlur after the text
> box but now that I have three, and I need the values to concatenate
> into one for the validation. Should I just fire a function after the
> 3rd field that concatenates the 3 values, then pass that value to the
> validation function? Or is there a better way?
>


Validating on blur is seen as rather hostile and un-professional, but
if you must,
just call the function with the onblur event of all the involved
fields, then have the
function abort if any field is blank.

--
S.C.



All times are GMT. The time now is 06:19 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57