[Javascript] regex example & code sample

Shawn Milo milo at linuxmail.org
Fri Apr 30 14:32:54 CDT 2004


<snip>

> > 1.  Without passing any parameters, I would have to make a separate copy
> of
> > this function for other forms which would use it.  It has been designed
> > in this case to be "tacked on" to a page over which I have no control of
> > the form or naming conventions of the text boxes.  So I have to pass the
> > text box names, and I have to pass the form somehow, in order to allow for
> > a document with multiple forms.  As is, this .js can be referred to by any
> > number of pages.
> 
> That's why I specifically mentioned that in looking at it's possible uses,
> you can narrow this down. How many places on a well-designed site will allow
> you to change Password information? I can't think of any reason there will
> be more than 1.  

Usually, that would be correct.  But since I am in charge of the
entire intranet here, it is probable that this will be used in more than
one place, until they finish putting in the Active Directory and we'll
use that for authentication.  But for now, it it currently being used
in at least two places.  I agree, it would be trivial to just have
two customized versions.


>And this is obviously tied to one instance since I see
> you're blocking certain brand names. In its current state, this isn't a
> script that is readily avaiable to be placed on just any site.

It is, however, readily available to be used on any site within
the Campbell Soup intranet, which is where it is used.  
(Note:  I control only the Godiva intranet, not all of Campbell,
but my work is sometimes shared among companies.)  Campbell Soup
owns Godiva, Pepperidge Farm, and the other names mentioned in
the script.  


> 
> 
> 
> > 2.  While using "eval" may not be the prettiest or best way, I really
> > wouldn't get anything out of changing it in *this* case because
> > I have no need to manipulate the form or any of its contents in this case.
> > Again, because I'm not really supposed to be doing anything
> > aside from giving a "helping hand" to the password change page provided by
> > a third party.
> 
> You're correct that in *this* instance it doesn't serve a purpose, but
> you're still needlessly limiting yourself.
> 

Noted.  Agreed.

> And if there is one thing more important than actual syntax when it comes to
> business logic is to NEVER expect that what you create now will never need
> to change.
> 

Very true.

> Sometime's an employer's logic is more convoluted than the actual business
> logic. They'll tell you to do one thing, insisting it will never change, but
> once you're around long enough, you'll have learned that you almost always
> have revisit something to modify it.
> 
No comment.  ;o)

> Chris Tifer
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript

Good discussion.  I appreciate that you gave me a wider view of the problem. 
I'll remember these things for future work.  Like I said, I may have been
sloppy in the past due to the fact that I learned all the js I know by doing
Google searches while in the middle of a project.  Thus, all of my code may
*work*, but not be great code.

Shawn



More information about the Javascript mailing list