Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

need to remove hyphen from textbox  RSS feed

 
lina ajay
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to pass an account number in the text area where hyphen in the number shouldn't be passed.e.g 1234_5678

should be passed to datbase as 12345678.. can someone please let me know how to accomplish this.

thanks

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where's your code? Where and when do you want this to occur?
 
lina ajay
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Where's your code? Where and when do you want this to occur?

whenever there is a hyphen in the account number,the script should remove it .my code:

}else if(bAccount.value.charAt("0") == "*") {
bAccount.focus();
alert("Please enter the correct account number");
return;

document.getElementById('eftUsage').value = "P";
document.getElementById('frmDefPayment').submit();
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not see what the code you posted has to do with the issue.

Just check to see of the string contains a hyphen and if so remove it. The string methods have everything you need.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would you do it in Java or another language? I am sure you would use replace.

Eric
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!