Javascript search string for a comma

  • s15199d
  • Expert
  • Expert
  • User avatar
  • Posts: 524
  • Loc: NC, USA

Post 3+ Months Ago

I need to search a string for a comma anywhere w/in this string. The string is the result of textbox input by a user. If the comma is present I need to alert an error message.

Any ideas? Pseudo code would be fantastic!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • s15199d
  • Expert
  • Expert
  • User avatar
  • Posts: 524
  • Loc: NC, USA

Post 3+ Months Ago

Code: [ Select ]
if(document.temp.BorrowLoan_Bloanamt.value != "")
    {
        var comma = ",/g";
        var string = docment.temp.BorrowLoan_Bloanamt.value;
        string.replace(comma,"");
    }
  1. if(document.temp.BorrowLoan_Bloanamt.value != "")
  2.     {
  3.         var comma = ",/g";
  4.         var string = docment.temp.BorrowLoan_Bloanamt.value;
  5.         string.replace(comma,"");
  6.     }


What I did to error trap was just replaced the potential offending characters with null string. I didn't test it but this looks pretty straight foward to me.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 74 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.