• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

Remove first 3 characters

I'm not very good at Javascript, I'm using Dreamweamer's built in form validation and the problem is the error message is using the input field name instead of value, so for example it's using "txtName" instead of just "Name".

"nm"  here is representing my input field name. All my field names have an extra 3 characters (like 'txt') at the begining. Can I somehow add something to this line of code and have those preceding first 3 letters removed from nm in the below line of code?

errors+='- '+nm+' must contain an e-mail address.\n';

Thank you so much.
2 Solutions
Hi axa905,

Try this,

errors+='- '+ nm.substring(3,nm.length-3) +' must contain an e-mail address.\n';

Hope this helps,
Give that a shot...

errors+='- '+nm.substring(3,nm.length)+' must contain an e-mail address.\n';

ZvonkoSystems architectCommented:
Here my proposal:

   errors+='- '+nm.substr(3)+' must contain an e-mail address.\n';

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now