checking for proper double

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Javilen
    New Member
    • Sep 2007
    • 20

    checking for proper double

    I have an app where people scan orders in and we pull all the details, they then confirm and correct details that scanned incorrectly.

    One field is price, what the client is starting to do is enter invalid prices, for example today they entered “.” And that’s it, which crashes a back end app that converts the xml to EDI and sends it to the supplier.

    I would like to put in some checks that will do something like a pattern match.

    If they enter a value other then “*#*” or “*#.#*” or “*#*,#*.#*”

    Is there a quick function in JavaScript that I can pop in my “Format” and the field and get a true/false value returned on if it matches the pattern or not.

    Thanks
  • mrhoo
    Contributor
    • Jun 2006
    • 428

    #2
    javascript is the least of your troubles- put some validation on the server right now. Never depend on javascript to protect your network from bad input.

    You can easily use javascript to prevent any form submission until the input is all in the syntax the server expects- this is called validating the form fields, and has been part of scripting since before IE. But it was never meant to protect the server. Client side validating is a convenience to the user, and a reduction in wasted bandwidth, but it can't be all you got.

    Comment

    Working...