Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Substring a value for display and concatenate for validation?

Reply
Thread Tools

Substring a value for display and concatenate for validation?

 
 
Kermit Piper
Guest
Posts: n/a
 
      02-28-2006
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

 
Reply With Quote
 
 
 
 
Stephen Chalmers
Guest
Posts: n/a
 
      02-28-2006

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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate/De-Concatenate Carlos VHDL 10 10-24-2012 01:04 PM
concatenate text with a bound value in a gridview field smccauslin@comcast.net ASP .Net 2 09-12-2006 02:51 AM
RegEx search for a substring within a substring colinhumber@gmail.com Perl Misc 3 08-03-2005 04:29 PM
Concatenate datalist variables with javascript and html Luis Esteban Valencia ASP .Net 0 01-20-2005 01:57 PM
Q: Concatenate lines which have the same key value Magnus Perl Misc 8 01-13-2004 06:20 PM



Advertisments